Skip to content

Instantly share code, notes, and snippets.

@bigdigital
Last active February 5, 2017 09:57
Show Gist options
  • Save bigdigital/f0001e3c773b5cb40fc8392950662dbb to your computer and use it in GitHub Desktop.
Save bigdigital/f0001e3c773b5cb40fc8392950662dbb to your computer and use it in GitHub Desktop.
The7 theme breadcrumbs integration under the main menu
//put in in functions.php in main or child theme
//add breadrums to main menu
function custom_breadcrumbs() {
$config = Presscore_Config::get_instance();
// get breadcrumbs
if ( $config->get( 'page_title.breadcrumbs.enabled' ) ) {
$breadcrumbs = presscore_get_page_title_breadcrumbs();
} else {
$breadcrumbs = '';
}
echo '<div class="custom-breadcrumbs">' . $breadcrumbs . '</div>';
}
add_action( 'presscore_primary_nav_menu_after' , 'custom_breadcrumbs');
//override title to remove old breadcrums
function presscore_page_title_controller() {
$config = Presscore_Config::get_instance();
if ( ! ( $config->get( 'page_title.enabled' ) || $config->get( 'page_title.breadcrumbs.enabled' ) ) ) {
return;
}
$show_page_title = ( presscore_is_post_title_enabled() && presscore_is_content_visible() );
if ( ! $show_page_title ) {
return;
}
$page_title_wrap_attrs = '';
$parallax_speed = $config->get( 'page_title.background.parallax_speed' );
if ( $parallax_speed ) {
$page_title_wrap_attrs .= ' data-prlx-speed="' . $parallax_speed . '"';
}
$title_height = absint( $config->get( 'page_title.height' ) );
$page_title_wrap_attrs .= ' style="min-height: ' . $title_height . 'px;"';
$page_title_wrap_table_style = ' style="height: ' . $title_height . 'px;"';
?>
<div <?php echo presscore_get_page_title_wrap_html_class( 'page-title' ), $page_title_wrap_attrs; ?>>
<div class="wf-wrap">
<div class="wf-container-title">
<div class="wf-table"<?php echo $page_title_wrap_table_style; ?>>
<?php
// get page title
if ( $config->get( 'page_title.enabled' ) ) {
$page_title = '<div class="wf-td hgroup"><h1 ' . presscore_get_page_title_html_class() . '>' . presscore_get_page_title() . '</h1></div>';
} else {
$page_title = '';
}
$page_title = apply_filters( 'presscore_page_title', $page_title );
// get breadcrumbs
$breadcrumbs = '';
// output
if ( 'right' == $config->get( 'page_title.align' ) ) {
echo $breadcrumbs, $page_title;
} else {
echo $page_title, $breadcrumbs;
}
?>
</div>
</div>
</div>
</div>
<?php
}
/*positioning breadcrumbs to right bottom corner*/
#primary-menu {
position: relative;
}
#primary-menu .custom-breadcrumbs {
position: absolute;
bottom: 0;
right: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment