Skip to content

Commit

Permalink
resolves #382
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesros161 committed Dec 13, 2021
1 parent 3499a58 commit f483ce2
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/includes/class-boldgrid-framework-title.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public function show_title( $title, $id ) {
// This method only needs to be ran if we're looking at a page, post, archive, or blog.
$is_single = is_page() || is_single();
$is_multi = is_home() || is_archive();
$is_page = is_page();

$allowed = $is_single || $is_multi;

Expand All @@ -232,6 +233,14 @@ public function show_title( $title, $id ) {
return $title;
}

if ( $is_page && did_action( 'boldgrid_main_top' )) {
return $title;
}

if ( $is_single && did_action( 'bgtfw_after_post_header' ) ) {
return $title;
}

/*
* The the_title filter is ran quite often. For example, when displaying nav menus, this filter
* is ran and can change a page's title in the nav. We're only interested in adjusting the
Expand All @@ -241,18 +250,18 @@ public function show_title( $title, $id ) {
return $title;
}

// Check for widget areas displayed within the main content and don't modify those.
if ( did_action( 'dynamic_sidebar_before' ) && ! did_action( 'dynamic_sidebar_after' ) ) {
return $title;
}

// Handle the title existing outside of the loop.
if ( $is_multi ) {

// Check that filter is being applied only inside of our main content area.
if ( ! did_action( 'boldgrid_main_top' ) || did_action( 'boldgrid_main_bottom' ) ) {
return $title;
}

// Check for widget areas displayed within the main content and don't modify those.
if ( did_action( 'dynamic_sidebar_before' ) && ! did_action( 'dynamic_sidebar_after' ) ) {
return $title;
}
}

$post_meta = get_post_meta( $id, $this->configs['title']['hide'], true );
Expand Down

0 comments on commit f483ce2

Please sign in to comment.