最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Title tag on home using front-page template not showing

programmeradmin3浏览0评论

Currently in header I have the following:

<title>
    <?php wp_title(' | ', true, 'right'); ?>
    <?php bloginfo('name'); ?>
</title>

I tried adding if statement like the following below that did not work it displayed as the following: Roots Restaurant Roots Restaurant

<?php if(is_front_page()) {bloginfo('name');}?>

It should display as Home | Roots Restaurant

on Home page the title tag looks like the following - Roots Restaurant. So it is missing Home |

Currently in header I have the following:

<title>
    <?php wp_title(' | ', true, 'right'); ?>
    <?php bloginfo('name'); ?>
</title>

I tried adding if statement like the following below that did not work it displayed as the following: Roots Restaurant Roots Restaurant

<?php if(is_front_page()) {bloginfo('name');}?>

It should display as Home | Roots Restaurant

on Home page the title tag looks like the following - Roots Restaurant. So it is missing Home |

Share Improve this question edited Jul 13, 2020 at 15:16 Rejaur Rahman asked Jul 13, 2020 at 13:25 Rejaur RahmanRejaur Rahman 51 silver badge3 bronze badges 3
  • 1 It's clearer to put in your question one piece of code which shows how your entire code looks now. – mozboz Commented Jul 13, 2020 at 14:16
  • @mozboz updated the description – Rejaur Rahman Commented Jul 13, 2020 at 15:16
  • Did you add theme support for the title-tag (in functions.php)? – ralphjsmit Commented Jul 13, 2020 at 15:19
Add a comment  | 

1 Answer 1

Reset to default 0

Fixed the bug, pasting the solution here.

        <?php
            if (is_front_page()) {
                echo 'Home | ';
                bloginfo('name');
            }
            else {
                wp_title(' | ', true, 'right');
                bloginfo('name');
            }
        ?>
发布评论

评论列表(0)

  1. 暂无评论