From 3d70b71053c6b6e41d02f8eaf1ad6593f4bec51e Mon Sep 17 00:00:00 2001 From: Nicholas Pagazani <41761220+nickpagz@users.noreply.github.com> Date: Sat, 25 Jul 2026 12:57:07 +0200 Subject: [PATCH] Fix fatal errors in osi theme attachment/direct-access paths - osi_posted_on(): remove argument-less sprintf() that treated the permalink HTML as a format string. On attachment pages the URL can contain a literal % (e.g. %43), which sprintf read as positional placeholder %43$ and threw ArgumentCountError, white-screening the page. Replaced with plain concatenation (there were no placeholders). - index.php: add defined( 'ABSPATH' ) || exit; guard so direct HTTP requests to the theme file no longer fatal on undefined get_header(). Co-Authored-By: Claude Opus 4.8 (1M context) --- themes/osi/inc/template-tags.php | 5 +---- themes/osi/index.php | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/themes/osi/inc/template-tags.php b/themes/osi/inc/template-tags.php index a83a419..90d8330 100755 --- a/themes/osi/inc/template-tags.php +++ b/themes/osi/inc/template-tags.php @@ -33,10 +33,7 @@ function osi_posted_on( string $format = '' ) { esc_html( get_the_modified_date( $format ) ) ); - $posted_on = sprintf( - /* translators: %s: post date. */ - '' . $time_string . '' - ); + $posted_on = '' . $time_string . ''; echo '' . $posted_on . ''; // phpcs:ignore } diff --git a/themes/osi/index.php b/themes/osi/index.php index bf1e0e5..8e5529e 100755 --- a/themes/osi/index.php +++ b/themes/osi/index.php @@ -12,6 +12,8 @@ * @package osi */ +defined( 'ABSPATH' ) || exit; + get_header(); ?>