[wp-trac] [WordPress Trac] #42905: add_filter( 'the_title',<func>, 99 ); woudn't fire after add_shortcode
WordPress Trac
noreply at wordpress.org
Fri Dec 15 08:49:19 UTC 2017
#42905: add_filter( 'the_title',<func>, 99 ); woudn't fire after add_shortcode
-------------------------------+------------------------------
Reporter: strech | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Shortcodes | Version: 4.9.1
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by strech):
@dd32 you are right
i want to clear the page and to only show "album content" if the url
parameter "album" is set and the shortcode is loaded.
{{{#!php
<?php
function replaceContent($content) {
if( $this->showAlbum) { // this works!
return $this->showAlbum($this->showAlbum);
}else {
return $content;
}
}
function replaceTitle( $title ) {
if( $this->showAlbum) { // always false
return " Album ";
}else {
return $title;
}
}
function show($atts){
if (isset($_GET['album'])) {
$this->showAlbum = $atts; // attrs are set!
}else {
return $this->showCollection($atts);
}
}
}}}
Yes it's possible do this check erlier at the_content by usind
"has_shortcode". But this will return true anyway also if the shortcode is
hidden by a other shortcode
{{{
[hide] [myShortcode] [/hide]
}}}
Because of this i run the "add_shortcode" and if this was successfull i
replace content and title.
So it's not possible to edit the title after "add_shortcode" ? Is there a
timeline to learn which function has which live time? is there a other
way?
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42905#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list