Snippi
A super awesome snippet tool.
- 1.
These are in the functions.php file. - 2.
- 3.
/** - 4.
* This function is used to generate custom breadcrumbs for single posts view. Portfolio section or regular Blog is considered - 5.
* when generating the link structure. - 6.
*/ - 7.
function get_category_parents_for_breadcrumbs( $id, $link = false, $separator = '/' ) { - 8.
global $udesign_options, $portfolio_pages_array; - 9.
$portfolio_cats_array = explode( ',', $udesign_options['portfolio_categories'] ); - 10.
if ( post_is_in_category_or_descendants($portfolio_cats_array) ) { // if the current post belongs to any Porfolio category - 11.
foreach ( $portfolio_pages_array as $portfolio_page_obj ) { - 12.
$port_page_ID = $portfolio_page_obj->ID; - 13.
if ( post_is_in_category_or_descendants( $udesign_options['portfolio_cat_for_page_'.$port_page_ID] ) ) { - 14.
echo get_category_parents_for_portfolio_page( $id, $link, $separator, FALSE , $port_page_ID ); - 15.
break; - 16.
} - 17.
} - 18.
- 19.
- 20.
/* Load breadcrumbs script */ - 21.
if ($udesign_options['show_breadcrumbs'] == 'yes') - 22.
include( 'scripts/breadcrumbs.php' ); - 23.
- 24.
} else { // if the current category is a regular blog category - 25.
echo get_category_parents( $id, $link, $separator, FALSE ); - 26.
} - 27.
}