-
lcwoffindin
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.
-
lcwoffindin
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);
- You must be logged in to reply to this topic.