Skip to content

Commit

Permalink
chore: add breadcrumbs support
Browse files Browse the repository at this point in the history
  • Loading branch information
cristian-ungureanu committed Jul 4, 2019
1 parent 79d3a1c commit 717a1b3
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
2 changes: 2 additions & 0 deletions globals/utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ function neve_hooks() {
'post' => array(
'neve_before_post_content',
'neve_after_post_content',
'neve_before_loop',
),
'page' => array(
'neve_before_page_header',
'neve_before_content',
'neve_after_content',
'neve_before_page_comments',
Expand Down
52 changes: 52 additions & 0 deletions inc/compatibility/yoast.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php
/**
* Yoast Compatibility.
*
* @package Amp.php
*/

namespace Neve\Compatibility;

/**
* Class Yoast
*
* @package Neve\Compatibility
*/
class Yoast {

/**
* Module init.
*/
public function init(){
$this->load_breadcrumbs();
}

/**
* Load hooks and filters.
*/
private function load_breadcrumbs() {
if ( ! function_exists('yoast_breadcrumb') ){
return;
}
$breadcrumbs_hooks = apply_filters(
'neve_breadcrumbs_locations',
array(
'neve_before_loop',
'neve_before_page_header',
'neve_before_post_content'
)
);

foreach ( $breadcrumbs_hooks as $hook ){
add_action( $hook, array( $this, 'render_yoast_breadcrumbs') );
}
}

/**
* Render Yoast Bredcrumbs.
*/
public function render_yoast_breadcrumbs(){
yoast_breadcrumb( '<small id="breadcrumbs" style="margin-bottom: 20px; display: block;">','</small>' );
}

}
1 change: 1 addition & 0 deletions inc/core/core_loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ private function define_modules() {
'Compatibility\Amp',
'Compatibility\Beaver',
'Compatibility\Lifter',
'Compatibility\Yoast',

'Admin\Metabox\Manager',
)
Expand Down
3 changes: 2 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<?php do_action( 'neve_do_sidebar', 'blog-archive', 'left' ); ?>
<div class="nv-index-posts blog col">
<?php
do_action( 'neve_before_loop' );
do_action( 'neve_page_header', 'index' );
do_action( 'neve_before_posts_loop' );
if ( have_posts() ) {
Expand Down Expand Up @@ -43,7 +44,7 @@
do_action( 'neve_middle_posts_loop' );
}
$post_index ++;
}
}
}
echo '</div>';
if ( ! is_singular() ) {
Expand Down
1 change: 1 addition & 0 deletions page.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<?php do_action( 'neve_do_sidebar', 'single-page', 'left' ); ?>
<div class="nv-single-page-wrap col">
<?php
do_action( 'neve_before_page_header' );
do_action( 'neve_page_header', 'single-page' );
do_action( 'neve_before_content', 'single-page' );
if ( have_posts() ) {
Expand Down

0 comments on commit 717a1b3

Please sign in to comment.