Fix typography CSS: wrong selector + overly restrictive meta gate

CSS targeted .post-content but the theme template uses .entry-content.
Also removed the _prautoblogger_generated meta check — display settings
should apply site-wide to all posts, not just PRAutoBlogger-generated
ones.

Bump 0.7.0 → 0.7.1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
peptiderepo
2026-04-20 13:02:31 +07:00
parent a37fb843a3
commit 01ef135bf9
3 changed files with 25 additions and 26 deletions

View File

@@ -5,6 +5,15 @@ All notable changes to PRAutoBlogger will be documented in this file.
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project uses [Semantic Versioning](https://semver.org/). and this project uses [Semantic Versioning](https://semver.org/).
## [0.7.1] — 2026-04-20
### Fixed
- **Typography CSS not applying.** Two bugs: CSS targeted `.post-content`
but the theme template uses `.entry-content`, and the
`_prautoblogger_generated` meta gate excluded posts that predate the
meta flag. Display settings now apply to all single post pages and
target the correct `.entry-content` selector.
## [0.7.0] — 2026-04-20 ## [0.7.0] — 2026-04-20
### Added ### Added

View File

@@ -4,9 +4,9 @@ declare(strict_types=1);
/** /**
* Injects frontend typography and table styles for PRAutoBlogger-generated posts. * Injects frontend typography and table styles for PRAutoBlogger-generated posts.
* *
* What: Outputs inline CSS on single post pages that have the * What: Outputs inline CSS on all single post pages, applying
* _prautoblogger_generated meta flag, applying user-configured * user-configured font family, font size, and table border
* font family, font size, and table border styles. * styles from the Display admin settings.
* Who calls it: PRAutoBlogger::register_frontend_hooks() hooks this * Who calls it: PRAutoBlogger::register_frontend_hooks() hooks this
* into wp_head. * into wp_head.
* Dependencies: Reads wp_options for typography settings. * Dependencies: Reads wp_options for typography settings.
@@ -27,10 +27,10 @@ class PRAutoBlogger_Article_Typography {
private const OPT_TABLE_BORDERS = 'prautoblogger_table_borders'; private const OPT_TABLE_BORDERS = 'prautoblogger_table_borders';
/** /**
* Output inline CSS in <head> for PRAutoBlogger posts. * Output inline CSS in <head> for single post pages.
* *
* Only outputs on singular post pages generated by PRAutoBlogger. * Applies to all posts — typography settings are site-wide.
* The CSS targets .post-content (PR Theme's article body class) * The CSS targets .entry-content (PR Theme's article body class)
* and overrides the theme's CSS custom properties so the cascade * and overrides the theme's CSS custom properties so the cascade
* works naturally with headings and sub-elements. * works naturally with headings and sub-elements.
* *
@@ -43,11 +43,6 @@ class PRAutoBlogger_Article_Typography {
return; return;
} }
$post_id = get_queried_object_id();
if ( '1' !== get_post_meta( $post_id, '_prautoblogger_generated', true ) ) {
return;
}
$css = $this->build_css(); $css = $this->build_css();
if ( '' === $css ) { if ( '' === $css ) {
return; return;
@@ -73,7 +68,7 @@ class PRAutoBlogger_Article_Typography {
$font_family = $this->get_font_family_stack(); $font_family = $this->get_font_family_stack();
if ( '' !== $font_family ) { if ( '' !== $font_family ) {
$rules[] = sprintf( $rules[] = sprintf(
".post-content,\n.post-content p,\n.post-content li {\n\tfont-family: %s;\n}", ".entry-content,\n.entry-content p,\n.entry-content li {\n\tfont-family: %s;\n}",
$font_family $font_family
); );
} }
@@ -81,7 +76,7 @@ class PRAutoBlogger_Article_Typography {
$font_size = absint( get_option( self::OPT_FONT_SIZE, 0 ) ); $font_size = absint( get_option( self::OPT_FONT_SIZE, 0 ) );
if ( $font_size > 0 ) { if ( $font_size > 0 ) {
$rules[] = sprintf( $rules[] = sprintf(
".post-content,\n.post-content p,\n.post-content li {\n\tfont-size: %dpx;\n\tline-height: 1.7;\n}", ".entry-content,\n.entry-content p,\n.entry-content li {\n\tfont-size: %dpx;\n\tline-height: 1.7;\n}",
$font_size $font_size
); );
} }
@@ -89,22 +84,22 @@ class PRAutoBlogger_Article_Typography {
$table_borders = get_option( self::OPT_TABLE_BORDERS, '1' ); $table_borders = get_option( self::OPT_TABLE_BORDERS, '1' );
if ( '1' === $table_borders ) { if ( '1' === $table_borders ) {
$rules[] = implode( "\n", [ $rules[] = implode( "\n", [
'.post-content table {', '.entry-content table {',
"\tborder-collapse: collapse;", "\tborder-collapse: collapse;",
"\twidth: 100%;", "\twidth: 100%;",
"\tmargin: 1.5em 0;", "\tmargin: 1.5em 0;",
'}', '}',
'.post-content th,', '.entry-content th,',
'.post-content td {', '.entry-content td {',
"\tborder: 1px solid #d1d5db;", "\tborder: 1px solid #d1d5db;",
"\tpadding: 0.6em 1em;", "\tpadding: 0.6em 1em;",
"\ttext-align: left;", "\ttext-align: left;",
'}', '}',
'.post-content thead th {', '.entry-content thead th {',
"\tbackground: #f3f4f6;", "\tbackground: #f3f4f6;",
"\tfont-weight: 600;", "\tfont-weight: 600;",
'}', '}',
'.post-content tbody tr:nth-child(even) {', '.entry-content tbody tr:nth-child(even) {',
"\tbackground: #f9fafb;", "\tbackground: #f9fafb;",
'}', '}',
] ); ] );
@@ -158,7 +153,7 @@ class PRAutoBlogger_Article_Typography {
/** /**
* Enqueue Google Fonts stylesheet when a web font is selected. * Enqueue Google Fonts stylesheet when a web font is selected.
* *
* Only loads on singular PRAutoBlogger posts that use a Google-hosted font. * Only loads on singular post pages that use a Google-hosted font.
* *
* Side effects: enqueues a remote stylesheet. * Side effects: enqueues a remote stylesheet.
* *
@@ -169,11 +164,6 @@ class PRAutoBlogger_Article_Typography {
return; return;
} }
$post_id = get_queried_object_id();
if ( '1' !== get_post_meta( $post_id, '_prautoblogger_generated', true ) ) {
return;
}
$font = sanitize_text_field( get_option( self::OPT_FONT_FAMILY, 'default' ) ); $font = sanitize_text_field( get_option( self::OPT_FONT_FAMILY, 'default' ) );
// Map font keys to Google Fonts URLs. Inter is already loaded by the theme. // Map font keys to Google Fonts URLs. Inter is already loaded by the theme.

View File

@@ -8,7 +8,7 @@ declare(strict_types=1);
* Plugin Name: PRAutoBlogger * Plugin Name: PRAutoBlogger
* Plugin URI: https://peptiderepo.com/prautoblogger * Plugin URI: https://peptiderepo.com/prautoblogger
* Description: Monitors social media for trending topics, generates SEO-friendly blog posts using AI, and publishes them on a daily schedule with full cost tracking and self-improvement metrics. * Description: Monitors social media for trending topics, generates SEO-friendly blog posts using AI, and publishes them on a daily schedule with full cost tracking and self-improvement metrics.
* Version: 0.7.0 * Version: 0.7.1
* Requires at least: 6.0 * Requires at least: 6.0
* Requires PHP: 7.4 * Requires PHP: 7.4
* Author: PeptideRepo * Author: PeptideRepo
@@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) {
| and limits without magic strings. | and limits without magic strings.
*/ */
define( 'PRAUTOBLOGGER_VERSION', '0.7.0' ); define( 'PRAUTOBLOGGER_VERSION', '0.7.1' );
define( 'PRAUTOBLOGGER_DB_VERSION', '1.1.0' ); define( 'PRAUTOBLOGGER_DB_VERSION', '1.1.0' );
define( 'PRAUTOBLOGGER_PLUGIN_FILE', __FILE__ ); define( 'PRAUTOBLOGGER_PLUGIN_FILE', __FILE__ );
define( 'PRAUTOBLOGGER_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); define( 'PRAUTOBLOGGER_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );