feat(wpmc S5): TitleFilter hooks the_title + single_cat_title do_shortcode
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace WPMultiCity;
|
||||||
|
|
||||||
|
final class TitleFilter
|
||||||
|
{
|
||||||
|
public static function register(): void
|
||||||
|
{
|
||||||
|
\add_filter('the_title', 'do_shortcode', 9999);
|
||||||
|
\add_filter('single_cat_title', 'do_shortcode', 9999);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace WPMultiCity\Tests;
|
||||||
|
|
||||||
|
use WPMultiCity\TitleFilter;
|
||||||
|
|
||||||
|
final class TitleFilterTest extends TestCase
|
||||||
|
{
|
||||||
|
public function test_register_attaches_the_title_do_shortcode_at_9999(): void
|
||||||
|
{
|
||||||
|
TitleFilter::register();
|
||||||
|
|
||||||
|
self::assertSame(
|
||||||
|
9999,
|
||||||
|
has_filter('the_title', 'do_shortcode'),
|
||||||
|
'TitleFilter::register() must hook the_title → do_shortcode at priority 9999'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test_register_attaches_single_cat_title_do_shortcode_at_9999(): void
|
||||||
|
{
|
||||||
|
TitleFilter::register();
|
||||||
|
|
||||||
|
self::assertSame(
|
||||||
|
9999,
|
||||||
|
has_filter('single_cat_title', 'do_shortcode'),
|
||||||
|
'TitleFilter::register() must hook single_cat_title → do_shortcode at priority 9999'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user