tag:blogger.com,1999:blog-3808846106371591937.post334536071665662864..comments2022-12-02T14:00:42.997+11:00Comments on Code-Tips.com - Web Development, Programming, SEO: WordPress Breadcrumb Navigation on Pages & Meta TitleDanielShttp://www.blogger.com/profile/07274977002584498975noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-3808846106371591937.post-86683507031925455862011-09-27T20:08:53.000+10:002011-09-27T20:08:53.000+10:00@globaltimoto,
The boolean value passed is a mod...@globaltimoto, <br /><br />The boolean value passed is a modification to the original Dimox code that only includes the link to home if false is passed. If true is passed, the home link is ignored, and the breadcrumb is outputted as text only.<br /><br />I have wrapped each of the examples below in comment lines to help destinguish my notes from each snippet from the modified function.<br /><br />Below is the top of the modified function, where the $before and $after variables are set to a blank string if true is passed:<br /><br />//start of example snippet ------------<br />function dimox_breadcrumbs($meta_title = false) {<br /> <br /> $delimiter = '&raquo;';<br /> $home = 'Home'; // text for the 'Home' link<br /> $before = '<span class="current">'; // tag before the current crumb<br /> $after = '</span>'; // tag after the current crumb<br /> <br /> if(!$meta_title)<br /> {<br /> $before = '<span class="current">'; // tag before the current crumb<br /> $after = '</span>'; // tag after the current crumb<br /> }<br /> else<br /> {<br /> $before = ''; // tag before the current crumb<br /> $after = ''; // tag after the current crumb<br /> }<br />//end of snippet ------------<br /><br />There are further minor tweaks throughout the function to only include html tags when false is passed to the function and also to include the home link only when true is passed. (Note: I haven't included the entire function, only modified sections)<br /><br />Only show home link if false:<br /><br />//start of example snippet ------------<br /> if(!$meta_title)<br /> echo '<div id="crumbs">';<br /> <br /> global $post;<br /> $homeLink = get_bloginfo('url');<br /> if(!$meta_title)<br /> echo '<a href="' . $homeLink . '">' . $home . '</a> ' . $delimiter . ' ';<br />//end of snippet ------------<br /><br /><br />Render as text if $meta_title is true:<br /><br />//start of example snippet ------------<br />if(!$meta_title)<br /> $breadcrumbs[] = '<a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a>';<br /> else<br /> $breadcrumbs[] = get_the_title($page->ID);<br />//end of snippet ------------<br /><br />Ignore html tags if $meta_title is true (bottom of function):<br /><br />//start of example snippet ------------<br />if(!$meta_title)<br /> echo '</div>';<br /> <br /> }<br />//end of snippet ------------<br /><br />The example code in the post above is the modified title tag, which includes the breadcrumb.<br /><br />The other page from the template I included the breadcrumb is the "Page Template" (page.php in my case):<br /><br />Close to the top of the page content, I included the following:<br /><br />//start of example snippet ------------<br /><?php dimox_breadcrumbs(); ?><br />//end of snippet ------------<br /><br />Inlcluding only on the page template meant that the breadcrumb would display when pages on the site were being viewed, but not posts and other content types.<br /><br />Please let me know if this helps. I have avoided re-posting the entire modified function, but can provide further explanation if required, but can provide further explanation if required. This was implemented on the <a href="http://phpfeedwriter.webmasterhub.net/" rel="nofollow">Php FeedWriter</a> Website.DanielShttps://www.blogger.com/profile/07274977002584498975noreply@blogger.comtag:blogger.com,1999:blog-3808846106371591937.post-258950691336537802011-09-24T00:12:57.830+10:002011-09-24T00:12:57.830+10:00Do you have an example of this or perhaps the fini...Do you have an example of this or perhaps the finished code so that I may try it out too ?Anonymousnoreply@blogger.com