Want to remove only certain tags from view in post
-
Hi All,
I am building a child theme for genesis. The theme is to be used as a review site.
When the end user submits a review they have a choice of adding certain tags which I have pre-defined such as “Dairy Free”, “Gluten Free” etc. I have changed the code in my child’s php so that the tag label no longer says “tagged as” but says “suitable for”. So when someone reads a review at the bottom it states “suitable for” – Gluten Free, Dairy Free etc. This is fine and works great.
To help with the SEO of my site I added the following to my child’s .php file to automatically add certain “tags” to the user submitted posts.
[code moderated - for any code longer than 10 lines, please use the https://pastebin.com/ - see forum guidelines for posting code]
I don't want these tags to be visible on the actual post as it says "Suitable For" and would then say "Allergy Friendly" or "Product Review" alongside "Gluten Free" "Dairy Free". I just want these tags to help with the SEO of the site. As all of the posts on the site are reviews and allergy friendly I am not doing anything underhand/blackhat as these tags are relevant but it just spoils the look of the post.
Does anyone know of a statement that I can code into my child's php file to hide just certain tags from showing up on the output of the post?
I thought that maybe something like
IF tag on post tag id= "20" "21" "22" then don't show output of tag on post
ELSE anything else display it.I have been in touch with support at studiopress (support for Genesis) and they have told me that
Genesis uses this code to create the list:
PHP Code:[dito]
It calls the get_the_tag_list() WordPress function which does have a filter ('the_tags'):
PHP Code:[dito]
Which uses the get_the_term_list() WordPress function which also has a filter named using the taxonomy ("term_links-$taxonomy").
PHP Code:[dito]
They then told me that "The 'genesis_post_tags_shortcode' filter is probably too late to be useful unless you know regular expressions (which most PHP programmers don't)".
Can anyone advise if they know of a statement or shortcode I can add to my child's .php file to just exclude certain tags from being visible in the post?
Many thanks in advance.
Kind Regards,
Deb
- The topic ‘Want to remove only certain tags from view in post’ is closed to new replies.