WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Yoast Breadcrumbs] Post title on "home" page (6 posts)

  1. Nicolas Messer
    Member
    Posted 5 years ago #

    I was wondering if there's a way so the post title of my latest post doesn't show up in the breadcrumbs on the "home" page (index.php file).

    Thanks for your help.

  2. Nicolas Messer
    Member
    Posted 5 years ago #

    Figured out a way of doing this without changing anything of the Plugin. Just put it in a div and use the is_home function, add a specific class to it and hide it when true.

  3. billweb
    Member
    Posted 5 years ago #

    aquadonis,

    Newbie here. Please write out the full code, where it goes, and in which file.

    And does what you've said allow the word "Home" to be removed from the home page only.

    Thanks much

  4. Nicolas Messer
    Member
    Posted 5 years ago #

    The Plugin can be found here:
    http://yoast.com/wordpress/breadcrumbs/

    Simply follow the instruction on the site and all should work fine.

    What I'm about to show you won't remove the word "Home" from the Breadcrumbs navigation but completly hide it on the "home" page.

    I'm using it as part of my navigation and want it to have on every site, I decided to put it in the header as I call this file everywhere on my blog. But the fact that on my "home" page the out put was "Home - name of the first post" annoyed me and I wanted it gone. So two solutions I found.

    1. Take the code out of the header and put it only in the files where I want the breadcrumbs to show up.
    2. Leave it in the header but don't make it show if it's on "home".

    Problem with #1, you have to put that code in a lot of files if you're using all the different page templates.

    "Problem" with #2, how do you know you're on the "home" page.

    So here's my code and CSS mark-up.

    <div <?php if (is_home()) { echo 'id="breadcrumbs-home"'; } else { echo 'id="breadcrumbs"'; } ?>><?php if ( function_exists('yoast_breadcrumb') ) {
    	yoast_breadcrumb('<p id="breadcrumbs">','
    ');
    } ?></div>

    This checking the "home" page and if true attributes a special class to it.

    #breadcrumbs-home {
    	visibility: hidden;
    	}

    This is hiding the Breadcrumbs on the "home" page.

    Hope this works for you.

    P.S.: you can't see it working on my blog yet, as I'm not yet using the new design.

  5. digikev
    Member
    Posted 5 years ago #

    This can be achieved without the DIV or CSS styling, just simply not show the breadcrumb on the home page by echoing nothing:

    <?php if (is_home()) {
    	echo '';
    } else {
    	if ( function_exists('yoast_breadcrumb') ) {
    		yoast_breadcrumb('<p id="breadcrumbs">','');
    	}
    } ?>
  6. Nicolas Messer
    Member
    Posted 5 years ago #

    @digikev - thanks for that tip ... wasn't thinking about that option when I was on it. You never see the easy stuff in your own code but always in the code of someone else.

    Going to adapt my code with your optimization ... once again thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic