Skip to content

Commit ec463ad

Browse files
RivianTrackrclaude
andcommitted
Fix duplicate page title on in-theme pages (1.53.1)
Themes print their own page-title <h1> above the_content, and the tire/review/compare content partials render their own headings — so the title showed twice. Blank the virtual post's display title via the the_title filter, scoped to the virtual post's ID 0 so real posts, nav menu items, and widgets are untouched. Document <title>, AIOSEO tags, and OG title are unaffected (they come from separate filters). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 3f00062 commit ec463ad

4 files changed

Lines changed: 26 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to the Rivian Tire Guide plugin will be documented in this f
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
66

7+
## [1.53.1] - 2026-07-03
8+
9+
### Fixed
10+
- **Duplicate page title on in-theme pages.** Themes print their own page-title `<h1>` above `the_content`, and the tire/review/compare content partials each render their own heading — so the title appeared twice (e.g. "Toyo Open Country A/T III (305/45R22) — Rivian Tire Guide" from the theme, then the tire `<h1>` again). `RTG_Theme_Render` now blanks the virtual post's display title via the `the_title` filter (scoped to the virtual post's ID `0`, so real posts, nav menus, and widgets are untouched). The browser-tab `<title>`, AIOSEO tags, and OG title are unaffected.
11+
712
## [1.53.0] - 2026-07-02
813

914
### Changed

includes/class-rtg-theme-render.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ public static function render( $args ) {
8888
remove_filter( 'the_content', 'wpautop' );
8989
add_filter( 'the_content', array( __CLASS__, 'filter_the_content' ), 9 );
9090

91+
// Themes print the page title themselves above the_content, but our
92+
// content partials render their own <h1> — blank the virtual post's
93+
// DISPLAY title so it isn't shown twice. The document <title> and
94+
// AIOSEO tags are unaffected (handled by the filters below).
95+
add_filter( 'the_title', array( __CLASS__, 'filter_the_title' ), 20, 2 );
96+
9197
// Title / description / canonical / robots via core + AIOSEO filters.
9298
add_filter( 'pre_get_document_title', array( __CLASS__, 'filter_document_title' ), 20 );
9399
add_filter( 'document_title_parts', array( __CLASS__, 'filter_document_title_parts' ), 20 );
@@ -119,6 +125,18 @@ public static function filter_the_content( $content ) {
119125
return ob_get_clean();
120126
}
121127

128+
/**
129+
* Suppress the theme-rendered page title for the virtual post (ID 0).
130+
* Real posts (nav menu items, widgets, other loops) have non-zero IDs
131+
* and pass through untouched.
132+
*/
133+
public static function filter_the_title( $title, $post_id = null ) {
134+
if ( self::$active && 0 === (int) $post_id ) {
135+
return '';
136+
}
137+
return $title;
138+
}
139+
122140
public static function filter_document_title( $title ) {
123141
return self::$active && self::$active['title'] ? self::$active['title'] : $title;
124142
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rivian-tire-guide",
3-
"version": "1.53.0",
3+
"version": "1.53.1",
44
"private": true,
55
"description": "Interactive tire guide for Rivian vehicles — WordPress plugin",
66
"scripts": {

rivian-tire-guide.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Plugin Name: Rivian Tire Guide
44
* Description: Interactive tire guide for Rivian vehicles with filtering, comparison, and ratings.
5-
* Version: 1.53.0
5+
* Version: 1.53.1
66
* Author: RivianTrackr
77
* Text Domain: rivian-tire-guide
88
* Requires at least: 5.8
@@ -14,7 +14,7 @@
1414
exit;
1515
}
1616

17-
define( 'RTG_VERSION', '1.53.0' );
17+
define( 'RTG_VERSION', '1.53.1' );
1818
define( 'RTG_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
1919
define( 'RTG_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
2020
define( 'RTG_PLUGIN_FILE', __FILE__ );

0 commit comments

Comments
 (0)