Я пытался заменить текст «Читать дальше» на кнопках в конце каждого сообщения в цикле запроса сообщения, например страницу архива, используя 3 версии кодов ниже. Ни один из них не сработал, текст «Читать дальше» остался прежним.
// 1
function custom_search_read_more_text( $more ) {
global $post;
return 'View Product';
}
add_filter( 'excerpt_more', 'custom_search_read_more_text' );
add_filter( 'the_content_more_link', 'custom_search_read_more_text' );
add_filter('the_excerpt', 'custom_search_read_more_text');
// 2
function new_excerpt_more($more) {
global $post;
return ' View Product ';
}
add_filter('excerpt_more', 'new_excerpt_more');
add_filter( 'the_content_more_link', 'new_excerpt_more' );
add_filter('the_excerpt', 'new_excerpt_more');
// 3
function custom_excerpt_read_more_link($text) {
global $post;
$text = preg_replace('/(\s*\[…\]\s*)|(\s*\[...\]\s*)/', '', $text);
$read_more_link = ' View Product';
return $text . $read_more_link;
}
add_filter('excerpt_more', 'custom_excerpt_read_more_link');
add_filter( 'the_content_more_link', 'custom_excerpt_read_more_link' );
add_filter('the_excerpt', 'custom_excerpt_read_more_link');
Подробнее здесь: https://stackoverflow.com/questions/797 ... ss-archive
Замена текста «Читать далее» на кнопках цикла пост-запроса (страница архива WordPress) ⇐ Php
Кемеровские программисты php общаются здесь
1760364845
Anonymous
Я пытался заменить текст «Читать дальше» на кнопках в конце каждого сообщения в цикле запроса сообщения, например страницу архива, используя 3 версии кодов ниже. Ни один из них не сработал, текст «Читать дальше» остался прежним.
// 1
function custom_search_read_more_text( $more ) {
global $post;
return 'View Product';
}
add_filter( 'excerpt_more', 'custom_search_read_more_text' );
add_filter( 'the_content_more_link', 'custom_search_read_more_text' );
add_filter('the_excerpt', 'custom_search_read_more_text');
// 2
function new_excerpt_more($more) {
global $post;
return ' View Product ';
}
add_filter('excerpt_more', 'new_excerpt_more');
add_filter( 'the_content_more_link', 'new_excerpt_more' );
add_filter('the_excerpt', 'new_excerpt_more');
// 3
function custom_excerpt_read_more_link($text) {
global $post;
$text = preg_replace('/(\s*\[…\]\s*)|(\s*\[...\]\s*)/', '', $text);
$read_more_link = ' View Product';
return $text . $read_more_link;
}
add_filter('excerpt_more', 'custom_excerpt_read_more_link');
add_filter( 'the_content_more_link', 'custom_excerpt_read_more_link' );
add_filter('the_excerpt', 'custom_excerpt_read_more_link');
Подробнее здесь: [url]https://stackoverflow.com/questions/79789289/replacing-read-more-text-on-the-buttons-of-post-query-loop-wordpress-archive[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия