What i mean is i am trying to add breadcrumbs to my blog and i thought of adding it before content or after title but there's an issue with that - on archive pages or category pages the breadcrumbs appear for every posts.
so i figured i have to attach the breadcrumbs to something above the post - like the head.
how can i do that ?
this is what I've done so far for the content:
add_filter( 'the_content', array($this, 'adding_bread_crumbs') );
function adding_bread_crumbs( $content ) {
/* Getting the current page permalink and site url */
$pageURl = preg_replace('/\/$/','',get_permalink());
$homeURL = preg_replace('/\/$/','',site_url());
if ( function_exists('yoast_breadcrumb')) {
/* Checking if the current page is home page */
if($pageURl != $homeURL && !is_page('Home')){
$breadcrumbs = '<div class="breadcrumbHolder">';
$breadcrumbs .= yoast_breadcrumb('<p id="breadcrumbs">','</p>',false);
$breadcrumbs .= '</div>';
$content = $breadcrumbs.$content;
}
}
return $content;
}
Is there anything that would replace 'the_content' another hook maybe? or is there an action i have to use ?
Thanks
do_action('my_breadcrumbs_hook');
into your theme?<?php do_action('my_breadcrumbs_hook'); ?>