• Hi,

    I’m looking to potentially modify the page title within a shortcode, depending on a saved setting. I can’t get my head around what I should be calling. Here’s what I’ve tried so far:

    if ($Filter_Title == "Yes") {
      add_filter('the_title', 'Alter_Title', 20, $ProductName);
    }

    Those lines are within a shortcode that is working normally. The code doesn’t seem to work, so any thoughts on where/how I should be adding the call to the filtering function would be appreciated!

Viewing 1 replies (of 1 total)
  • I think that by the time your shortcode gets processed, that the title has come and gone, you are too late to process it.

    Your Alter_Title function needs to be installed earlier, possibly in a customised page template, or in functions.php itself. You may need to add some conditional code within your filter so that I knows when to pass the title through unchanged and when to process it.

Viewing 1 replies (of 1 total)
  • The topic ‘Modify Title Within Shortcode Function’ is closed to new replies.