WordPress.org

Ready to get started?Download WordPress

Forums

Yoast Breadcrumbs
How to remove page title from breadcrumb (3 posts)

  1. pixeline
    Member
    Posted 2 years ago #

    This is actually not a question, but a hack that might be useful to others.

    I needed to remove the post title from the breadcrumb. Here is how i did it:

    <!-- breadcrumbs: start -->
    <?php if ( function_exists('yoast_breadcrumb') ) {
    	$opt = get_option("wpseo_internallinks");
    	$sep = ( isset($opt['breadcrumbs-sep']) && $opt['breadcrumbs-sep'] != '' ) ? $opt['breadcrumbs-sep'] : '»';
    	$breadcrumbs = yoast_breadcrumb('','',false);
    	$linksArr = split($sep, $breadcrumbs);
    	array_pop($linksArr);
    	echo '<nav id="breadcrumbs">'.implode($sep,$linksArr).'</nav>';
    } ?>
    <!-- breadcrumbs: end -->

    http://wordpress.org/extend/plugins/breadcrumbs/

  2. Unclesabre
    Member
    Posted 2 years ago #

    Thanks pixeline - up against a tight deadline and client asked for the breadcrumbs of a subset of the site to have a different home page:
    thesite.com/jobs/ to actually appear as the 'home' crumb in the trail.

    Using your technique, I shifted the relevant bits off the front (used on other parts of the site and hard coded the 'You are here:' to the front.

    Does what I'm (the client is!) after so thought it might help someone else:

    <?php if ( function_exists('yoast_breadcrumb') ) {
    	$opt = get_option("wpseo_internallinks");
    	$sep = ( isset($opt['breadcrumbs-sep']) && $opt['breadcrumbs-sep'] != '' ) ? $opt['breadcrumbs-sep'] : '»';
    	$breadcrumbs = yoast_breadcrumb('','',false);
    	$linksArr = split($sep, $breadcrumbs);
    	array_shift($linksArr);
    	array_shift($linksArr);
    	array_shift($linksArr);
    	echo '<div id="breadcrumbs">You are here: '.implode($sep,$linksArr).'</div>';
    } ?>

    Thanks for your tip.
    James

  3. deliwasista
    Member
    Posted 1 year ago #

    oh James thats what I need to do too.. im not quite sure what else I need to change to get it to work tho. Im guessing this needs to feature somewhere else? "wpseo_internallinks"

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic