我知道這種問題已被問了很多時間,我已閱讀所有帖子在網上,沒有答案滿足我的需要。將頁碼添加到分頁頁面的元標題WordPress的,Yoast
我無法使用yoast插件(爲了避免與搜索引擎重複的內容)將頁碼添加到分頁頁面上的元標題,包括主頁和分類。
我使用自定義元標題和描述,我試圖直接在自定義元標題上添加標記%% page %%,但它不工作。
我的主題是使用新功能:add_theme_support('title-tag');
這是header.php文件頭:
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-- >
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--[if lt IE 9]>
<script src="<?php print get_template_directory_uri();? >/assets/js/ie8/html5shiv.js"></script>
<script src="<?php print get_template_directory_uri();? >/assets/js/ie8/respond.min.js"></script>
<![endif]-->
<?php wp_head();?>
</head>
請幫幫忙,有很多人同樣的問題,因爲改變:add_theme_support(「標題標籤」);
任何建議,非常感謝。
更新: 在主題有一個文件:內容page.php文件, ,看起來像這樣:
<div class="post-header">
<h2>
<?php the_title();?>
</h2>
</div>
<div class="post-entry">
<?php the_content();?>
<?php
$defaults = array(
'before' => '<ul class="pagination">',
'after' => '</ul>',
'before_link' => '<li>',
'after_link' => '</li>',
'current_before' => '<li class="active">',
'current_after' => '</li>',
'previouspagelink' => '«',
'nextpagelink' => '»'
);
bootstrap_link_pages($defaults);
?>
</div>
嗨,感謝您的快速回答。剛剛添加你的代碼在function.php文件,不適合我,所有自定義元標題仍然沒有頁碼。 我可以看到一些不自定義的類別,顯示元標題標籤:第2頁,共6頁等等..因爲它在標籤%% page %%的yoast上設置,這個設置也在頁面上,但只是不起作用。 如果可能,我想添加像:第2頁,第3頁,等等,而不是第1頁,共8頁。 –