无法在 WordPress 中使用 wp_title() 函数显示页面标题 [英] Unable to Display Page Title Using wp_title() Function in WordPress

查看:19
本文介绍了无法在 WordPress 中使用 wp_title() 函数显示页面标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Can you please let me know how I can use the wp_title() function to grab each page titles in WordPress. I used the following code to get the title in different page based on titles but it dost' work!

这是我使用的代码

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

推荐答案

试试这个:

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

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

干杯!

这篇关于无法在 WordPress 中使用 wp_title() 函数显示页面标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆