[wp-trac] [WordPress Trac] #38545: Add span element to get_the_archive_title()

WordPress Trac noreply at wordpress.org
Thu Apr 23 11:53:04 UTC 2020


#38545: Add span element to get_the_archive_title()
-------------------------------------+------------------------
 Reporter:  Kaira                    |       Owner:  audrasjb
     Type:  enhancement              |      Status:  reviewing
 Priority:  normal                   |   Milestone:  5.5
Component:  Taxonomy                 |     Version:  4.6.1
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+------------------------
Changes (by Confridin):

 * keywords:  has-patch 2nd-opinion early => has-patch needs-testing


Comment:

 In [https://core.trac.wordpress.org/attachment/ticket/38545/38545.13.diff
 38545.13.diff] :
 - refresh patch with latest core file
 - did some tests with new filter, all work fine for me


 Can someone else test my patch ?
 {{{#!php
 <?php
 // Change prefix value
 add_filter( 'get_the_archive_title_prefix', 'sx_archive_prefix' );
 function sx_archive_prefix( $prefix ){
     $prefix = str_replace( "Category", "Awesome Category", $prefix );
     return $prefix;
 }

 }}}

 {{{#!php
 <?php
 // Add custom html to prefix
 add_filter( 'get_the_archive_title_prefix', 'sx_archive_prefix' );
 function sx_archive_prefix( $prefix ){
     return '<span>' . $prefix . '</span>';
 }
 }}}

 {{{#!php
 <?php

 // remove prefix
 add_filter( 'get_the_archive_title_prefix', '__return_empty_string' );
 }}}

 It solves :
 - this ticket
 - [https://core.trac.wordpress.org/ticket/42768 42768]
 - [https://core.trac.wordpress.org/ticket/31237 31237]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/38545#comment:82>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list