get_posts()
, и в цикле обновляете с помощью wp_update_post()
, т.е. передаете ей $post_id и 'post_type' => 'page'$custom_value
передаете новое значение для ссылки. Измененный текст у вас по прежнему в переменной $html$html = file_get_html($file_path);
// получаем ссылку
$link = $html->find( 'a.like', 0 );
$link->href = $custom_value;
$html->clear();
unset($html);
$html = file_get_html($file_path);
// получаем ссылку
$link = $html->find( 'a.some-class', 0 )->href;
$html->clear();
unset($html);
current_user_can( 'manage_options' )
, чтобы этот текст мог видеть тот, кто имеет права администратораfunction goods_value() {
if ( current_user_can( 'manage_options' ) ) {
echo '<p>Стоимость товаров на этой странице: ' . $p . '</p>';
echo '<p>Стоимость товаров в категории: ' . $c . '</p>';
echo '<p>Стоимость всех товаров на сайте: ' . $s . '</p>';
}
}
if ( file_exists( $file_path ) ) {
$html = file_get_html($file_path);
// получаем r-attr
$r_attr_text = $html->find( '.r-attr a', 0 )->plaintext;
$r_attr_link = $html->find( '.r-attr a', 0 )->href;
// получаем ссылки на изображения
$images = $html->find( '#msgood-gallery img' );
foreach ( $images as $key => $image ) {
$link = $image->src;
}
$html->clear();
unset($html);
}