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

php - My top header looks different on single pages but is fine on the home page

programmeradmin1浏览0评论

For some reason, my top header looks different on single pages but is fine on the home page. my site

     <?PHP
   if ( is_front_page() && is_home() ):
                    ?>
    <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">CC AND BUILDS</a> </h1>
    <?php
    else :
                    ?>
    <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">CC AND BUILDS</a></p>
    <?php
    endif;
    ?>

any ideas?

For some reason, my top header looks different on single pages but is fine on the home page. my site

     <?PHP
   if ( is_front_page() && is_home() ):
                    ?>
    <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">CC AND BUILDS</a> </h1>
    <?php
    else :
                    ?>
    <p class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home">CC AND BUILDS</a></p>
    <?php
    endif;
    ?>

any ideas?

Share Improve this question asked Dec 12, 2020 at 20:28 LootLoot 112 bronze badges 2
  • You've made a few mistakes, one of them is hardcoding the logo URL, but making it a relative URL not an absolute URL, as well as making the HTML tags different, if you want them to look the same you should make them be the same – Tom J Nowell Commented Dec 12, 2020 at 20:58
  • can you give me an example, please – Loot Commented Dec 12, 2020 at 21:02
Add a comment  | 

1 Answer 1

Reset to default 0

In the code snippet you posted, it appears that your site's title will be wrapped in an <h1> tag on the home page (that's what the if ( is_front_page() && is_home() ) code is checking for), and in a <p> tag in all other cases (eg, a single blog post's view).

发布评论

评论列表(0)

  1. 暂无评论