Support community for TTG plugins and products.
NOTICE
The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.
This forum is now closed, and exists here as a read-only archive.
You are not logged in.
Pages: 1
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 prever to have breadcrumbs on all pages. Thanks to phplugins, this is something that can easily be done.
First I use some helper functions to keep my code clear and legible:
function page_match($gallery) {
if (substr($_SERVER["REQUEST_URI"], 0, strlen($gallery)) == $gallery) {
return 1;
} else {
return 0;
}
}
function ttg_crumb( $page_name ) {
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>';
}
Breadcrumbs are located at the top of the 'main' section. So I use ttg_main_top to insert them:
function ttg_main_top( $style, $path ){
// Add breadcrumbs to non-gallery pages
if ( page_match('/about') ) {
ttg_crumb('About');
} elseif ( page_match('/contact') ) {
ttg_crumb('Contact');
} elseif ( page_match('/backlight/search') ) {
ttg_crumb('Search');
} elseif ( page_match('/xxxx') ) {
ttg_crumb('Xxxx');
}
}
If you have other pages on your site, just add them in another 'elseif' branch. All this code belongs into your custom phplugins file.
You find a bit more about phplugins in the documentation at http://backlight.theturninggate.net/doc … _phplugins.
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
This would be the corresponding code for Backlight 2:
function ttg_crumb( $page_name ) {
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->ttg_crumb('About');
} else if (strtolower($this->slug) == 'contact') {
$this->ttg_crumb('Contact');
} else if (strtolower($this->slug) == 'search') {
$this->ttg_crumb('Search');
} else if (strtolower($this->slug) == 'xxxx') {
$this->ttg_crumb('Xxxx');
}
}
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
Pages: 1