我成功地更改了搜索结果上方的“Results for:”部分,但似乎找不到如何更改浏览器选项卡中显示的页面标题文本。遗憾的是,它仍然是股票“X”的搜索结果,如下所示:
我还想更改“找不到”页面文本,但似乎找不到该文本的位置。最后,我似乎找不到如何改变“继续阅读”。它不同于“阅读更多…”WordPress文档中提到。
我成功地更改了搜索结果上方的“Results for:”部分,但似乎找不到如何更改浏览器选项卡中显示的页面标题文本。遗憾的是,它仍然是股票“X”的搜索结果,如下所示:
我还想更改“找不到”页面文本,但似乎找不到该文本的位置。最后,我似乎找不到如何改变“继续阅读”。它不同于“阅读更多…”WordPress文档中提到。
你必须在document_title_parts 筛选以根据您的需要进行调整。
Example:
/**
* Modify the document title for the search page
*/
add_filter( \'document_title_parts\', function( $title )
{
if ( is_search() )
$title[\'title\'] = sprintf(
esc_html__( \'“%s” result page\', \'my-theme-domain\' ),
get_search_query()
);
return $title;
} );
对于多页搜索页面,您必须执行以下操作:/**
* Modify the page part of the document title for the search page
*/
add_filter( \'document_title_parts\', function( $title ) use( &$page, &$paged )
{
if ( is_search() && ( $paged >= 2 || $page >= 2 ) && ! is_404() )
$title[\'page\'] = sprintf(
esc_html__( \'This is %s page\', \'my-theme-domain\' ),
max( $paged, $page )
);
return $title;
} );
根据您的需要修改我给出的示例。title-tag 必须由主题支持。
我想知道帖子缩略图是否需要“Alt title”,如“title”,以及如何将其添加到我的相关帖子查询中。。。我正在使用以下代码获取帖子缩略图:<div class=\"td-module-thumb\"> <a href=\"<?php the_permalink(); ?>\" title=\"<?php the_title_attribute(); ?>\"> <?php if (has_post_thumbnail()) {&#