无法在WordPress中使用wp_title()函数显示页面标题

你能告诉我如何使用wp_title()函数来获取WordPress中的每个页面标题吗?我使用以下代码根据标题在不同页面中获取了标题, 但它确实起作用!

这是我正在使用的代码

<title>
       <?php 
             if (is_front_page()) {
                          bloginfo('name'); }
             elseif (is_page()) {
                          wp_title(); echo ' - '; bloginfo('name'); }
       ?>
</title>

#1


尝试这个 :

<?php wp_title('|', true, 'right'); ?>

这是函数参考链接:http://codex.wordpress.org/Plugin_API/Filter_Reference/wp_title

干杯!


#2


你可以用

<title>
  <?php
    if ( is_home() ) {
      bloginfo('name');
    } else {
      wp_title('', true, '');
      echo " | ";
      bloginfo('name');
    }
  ?>
</title>

来源:

https://www.srcmini02.com/66836.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_40296.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?