[Support request] Custom Page Titles for Post with Taxonomy

Home Forums Support [Support request] Custom Page Titles for Post with Taxonomy

Home Forums Support Custom Page Titles for Post with Taxonomy

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1032410
    Thomas

    I have a group of blog post i like to Append the text “Product Review” to for the H1 Tag.

    Current post titles are just product names.

    I can technically just disable the page title manually for each page but there are no easy bulk options. Now this creates complexity in maintaining more code.

    I would like to tag these post with a tag “review” and if the post has this tag it overrides the default title + adds “Product Review”

    Im open for a cleaner way to going about this.

    #1032419
    Leo
    Staff
    Customer Support
    #1032422
    Thomas

    Well that is the idea except this is like adding a “Page Title Banner”

    All I Like to do is append additional text to the page title so I don’t have to manage any custom design or heading layouts.

    #1032458
    Thomas

    Would something like this be possible?

    https://generatepress.com/forums/topic/custom-page-titles-for-categories/

    except

    if( has_term( ‘jazz’, ‘genre’ ) ) {
    // do something
    }

    Tried looking for a content title filter for singular posts.

    #1032517
    Tom
    Lead Developer
    Lead Developer

    What if you created a shortcode?

    add_shortcode( 'title_append', function() {
        if ( has_term( 'jazz', 'genre' ) ) {
            return 'Text to append';
        }
    } );

    Then you can use the [title_append] shortcode.

    #1032520
    Thomas

    How would I go about adding it to the title with the shortcode?

    <h1>Page Title [title_append]</h1>

    #1032938
    Tom
    Lead Developer
    Lead Developer

    Are these regular titles? Or are you using the Elements module?

    #1032951
    Thomas

    Regular…

    #1033221
    Tom
    Lead Developer
    Lead Developer

    Ah, that’s not easy then, unfortunately. WP core does add a filter to the title (called the_title), but that filter applies to everything that has a title (menu items, widget titles, content titles and so on).

    The only solution I can think of is to:

    1. Disable the regular content title in the theme.
    2. Hook in a custom title using Elements.

    Let me know if that would work for you and I’ll outline the steps 🙂

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