Skip to content

Inline Search: Address Blaskan theme body class conflict with inline highlighter #43797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fixed

Addresses body_class filter fatal in older versions of the Blaskan theme.
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,19 @@ public function process_results( array $results ): void {
* @return string The filtered title.
*/
public function filter_highlighted_title( string $title, ?int $post_id = null ): string {
// o2 is currently rendering <mark> tags in post titles, so we need to return the original.
$body_class = get_body_class();
if ( is_array( $body_class ) && in_array( 'o2', $body_class, true ) ) {
return $title;
$incompatible_themes = array(
'blaskan', // Blaskan incorrectly uses wp_nav_menu() in body_class filter, causing infinite recursion.
'p2020', // P2 loads o2 as a plugin, which calls the_title() filter incorrectly.
Copy link
Contributor Author

@anaemnesis anaemnesis Jun 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

o2 is loaded as a plugin on P2, so I'm excluding instead on the basis of p2020 as the active theme. I don't think we need to include o2 separately, and even Blaskan is old enough that ehhh... But this should be a more robust approach, regardless.

);

$theme = wp_get_theme();
$theme_name = strtolower( $theme->get( 'Name' ) );
$theme_template = strtolower( $theme->get_template() );

foreach ( $incompatible_themes as $incompatible_theme ) {
if ( $theme_name === $incompatible_theme || $theme_template === $incompatible_theme ) {
return $title;
}
}

if ( ! $this->is_search_result( $post_id ) ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: bugfix

Addresses body_class filter fatal in older versions of the Blaskan theme.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: fixed

Addresses body_class filter fatal in older versions of the Blaskan theme.
Loading