Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Additional text with dynamic (GB) Heading block

  • I have an archive category template where I want the page H1 header to be the category name plus some additional text e.g. Board Member – Member Name
    Board Member is fixed text, Member Name is GenerateBlocks Headline block set to dynamically get the category title which is the member name.
    If I set 2 blocks as inlineblock side by side, that looks OK, but its actually two H1 tags – really bad.
    Is there a way to merge these together into one H1 tag, or insert dynamic text with no tags at all into a string in the middle of a tag.
    Thanks
    LenW

  • Hi there,

    you would need to use some PHP to filter either the blocks content or simply filter the get_the_archive_title to alter the text string.

    For example:

    
    function prefix_category_archive_title($title) {
        if (is_category()) {
            $title = 'Board Member – ' . single_cat_title('', false);
        }
        return $title;
    }
    add_filter('get_the_archive_title', 'prefix_category_archive_title');
    
    

    This will add that text before the Category Archive title.

  • David, thanks, this isnt working, although it looks as though it should.

  • Try this PHP snippet instead:

    
    function prefix_category_archive_title($title) {
        if (is_category()) {
            $title = 'Board Member – ' . single_cat_title('', false);
        }
        return $title;
    }
    add_filter('get_the_archive_title', 'prefix_category_archive_title', 20);
    
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.