Site logo

[Support request] Filter hook for {{post_title}}

Home Forums Support [Support request] Filter hook for {{post_title}}

Home Forums Support Filter hook for {{post_title}}

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1726836
    Ash

    Is there a filter hook for {{post_title}} in the Header Element?

    #1726876
    Leo
    Staff
    Customer Support

    Hi there,

    Not sure if I understand.

    That is just a template tag that outputs the post title in the header element.

    What are you hoping to achieve?

    #1726895
    Ash

    I’d like to modify the output conditionally on a CPT archive/taxonomies.

    #1726900
    Leo
    Staff
    Customer Support

    Then it might be easier to just create a shortcode for your need with something like this:
    https://generatepress.com/forums/topic/blog-post-title-customization/#post-1629477

    #1729108
    Ash

    Default page title won’t be hidden with the shortcode.
    Is there a setting to hide the default page title?

    #1729111
    Leo
    Staff
    Customer Support
    #1729163
    Ash

    Is there an argument of generate_show_title to pass through the default value?

    #1729173
    Ash

    Also somehow Disable Elements on the Layout Element is not working.
    Content Title doesn’t work on post/cpt archives. Other options such as Top bar works.

    #1729583
    David
    Staff
    Customer Support

    Hi there,

    you can see the function here:

    https://github.com/tomusborne/generatepress/blob/7b35168f546f83a7abb098a8da3bc0674d49ddeb/content-single.php#L36

    If its not working on your CPT then it would mean that the your template doesn’t include that function.

    #1732982
    Ash

    Neither Layout Element nor generate_show_title works, because it seems that they are not applied for the archive title.
    I found that generate_archive_title is needed to modify the archive title.
    Just FYI.

    add_action('wp',function(){
    if(is_post_type_archive('cpt-1')){
    remove_action('generate_archive_title','generate_archive_title');
    }
    },20);
    #1733692
    David
    Staff
    Customer Support

    Sorry my bad – i skimmed the topic and only saw the Post – not the archives…. glad yo found the solution

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.