Adding breadcrumbs to non-gallery pages

Backlight provides the option to use breadcrumbs on all gallery pages to simplify navigation. I like to have a common look and feel of my site and prefer to have breadcrumbs on all pages. Thanks to phplugins, this is something that can easily be done:

function my_crumb( $slug ) {
	// Create breadcrumbs structure for the given slug
	echo '<ul class="breadcrumbs"><li class="fa_pseudo" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/" itemprop="url"><span itemprop="title">Home</span></a></li><li class="fa_pseudo" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">'. $page_name .'</span></li></ul>';
}

function main_top(){
	// Add breadcrumbs to non-gallery pages
	if (strtolower($this->slug) == 'about') {
		$this->my_crumb('About');
	} else if (strtolower($this->slug) == 'contact') {
		$this->my_crumb('Contact');
	} else if (strtolower($this->slug) == 'search') {
		$this->my_crumb('Search');
	} else if (strtolower($this->slug) == 'xxxx') {
		$this->my_crumb('Xxxx');
	}
}

Did you like this post? Did you use the given code? Please consider supporting me by buying me a coffee!

Buy Me A Coffee


Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

Web Design Consulting

Do you need help designing your web site or getting Backlight working the way you want? Contact me to discuss your idea or project.


Buy me a Coffee

If you like what I share here, please consider buying me a coffee or a print. This helps keeping me motivated to continue posting. Thank you!

Buy Me A Coffee

Categories