• anonymized-7517021

    (@anonymized-7517021)


    How do I add the site description (in the browser) on the home page?
    I just want the site description on the home page in the browser, not on other pages.

    Now it’s like this: Site title

    I want it like this: Site title – Site description

    Here’s my header.php
    https://pastebin.com/bm99ayxz

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Rebecka.

    You mean only in index and not in categories, tags, searchs or post?

    Then you should use a template for each one and in index.php show the title you want.

    I hope it helps

    Thread Starter anonymized-7517021

    (@anonymized-7517021)

    No, I mean the meta or whatever it’s called. Right now there is no site description in the browser, only site title. Other pages will function as they do now, which is “Page name ? Site title”.

    From the beginning, I added this code:
    <?php bloginfo('description'); ?>

    Inside this:
    <title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>

    Like this:
    <title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?> &mdash; <?php bloginfo('description'); ?></title>

    But the problem is that the site description is on all pages, not just the home page.

    So it becomes “Page title ? Site title – Site description” which I don’t want to. I want the “Page title ? Site title” as now apart from the home page where I want “Site title – Site description” to be. From the beginning it’s just “Site title” on the home page.

    Hope I make myself understood.

    try and use a conditional statement, for example based on is_front_page() in your line.
    https://codex.www.ads-software.com/Conditional_Tags,

    example:

    <title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?> <?php if( is_front_page() ) { ?> &mdash; <?php bloginfo('description'); } ?></title>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display site description on home page only’ is closed to new replies.