WordPress.org

Ready to get started?Download WordPress

Forums

Title tag on index page and single pages (12 posts)

  1. kensav
    Member
    Posted 8 years ago #

    How do use just the Blog name in the title meta tag and if it's a single page then just use the post's title? I do not want to have the blog name on any single pages.

    Here's what I'm suing now:
    <?php bloginfo('name'); ?> <?php if ( is_single() ) { ?><?php wp_title(); ?><?php } ?>

  2. kensav
    Member
    Posted 8 years ago #

    Although this is close what I want, it show the name tag in the meta tag for title which I dont want.

    How do I get rid or the 'name' tag on single pages?

  3. kensav
    Member
    Posted 8 years ago #

    Is there a tag or php command I'm missing?

  4. pcmt
    Member
    Posted 8 years ago #

    I use this:

    <?php if(is_home()) { bloginfo('name'); } else { wp_title(); } ?>

    It displays the blog name on the homepage, and just the post or page title for posts or pages.

  5. kensav
    Member
    Posted 8 years ago #

    pcmt, thx man that's exactly what I wanted to do. Anyway to get rid of the >> though?

  6. incrediblehelp
    Member
    Posted 8 years ago #

    Where do I put this code?

  7. UMBM
    Member
    Posted 8 years ago #

    I'd like to know how to remove the » as well

  8. Kafkaesqui

    Posted 8 years ago #

    incrediblehelp, it's for the HTML <title> element. Where this is located depends on the theme, but most make use of a header.php template that holds the <head> element.

    UMBM, see the information on the 'sep' parameter for wp_title():

    http://codex.wordpress.org/Template_Tags/wp_title

  9. UMBM
    Member
    Posted 8 years ago #

    Thanks for the response Kafkaesqui, very helpful.

    To all those who may not know what to do after reading that link just change wp_title() to wp_title('') and the » will be gone

  10. alwaysfine
    Member
    Posted 8 years ago #

    thx, too.

  11. incrediblehelp
    Member
    Posted 8 years ago #

    Thanks everyone. I am just using this code because the one above doesnt seem to work:

    <title>
    <?php wp_title(' '); ?>
    <?php if(wp_title(' ', false)) { echo '--'; } ?>
    <?php bloginfo('name'); ?>
    </title>

  12. nieuws
    Member
    Posted 8 years ago #

    Thank you for this <?php if(is_home()) { bloginfo('name'); } else { wp_title(); } ?>

    Only problem i need to solve is that it shows a weird title in the searchfunction. For example:
    http://www.nieuwszicht.com/index.php?s=prdv&searchbutton=Go%21

    Is it possible to change that to for example: search results of 'searchstring' ?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags