Having a Unique Code on Certain Categories

Posted in: Newspaper
Post count: 263

I am trying to place a certain code below posts where the Related Articles are. I want to have this code display on only a few categories. Is this possible? For example, I want to have a widget/code below the ‘Funny’ category, but I don’t want it on the ‘Videos’ category. Is this possible to prevent that? Thanks in advance!

Post count: 6600

Hi,

You could do this by adding the code on the template of the page you want to have this code, for example if I understood well you want this on post pages and enable this only if the post belongs to a certain category and use a plugin like Advanced Custom Fields to chose when editing the post if to show that widget or not for that post so regarding the category that post belongs you can chose if that widget to be displayed or not.
Here is how you can do it, follow this topic: https://forum.tagdiv.com/topic/function-to-hide-ads-and-function-to-show-author/#post-8993
If you don’t have basic php/html/css knowledge we recommend you hire a freelancer from sites like: http://studio.envato.com/ if you don’t know how to do it yourself.
Unfortunately we cannot offer custom work as we work hard on the development, updates, fixes and support.

Thnaks

Post count: 263

For example, I am looking to display ‘code A’ below posts on a categories and posts 1 through 4. I am looking to display ‘code B’ on categories and posts 5 through 10.

Post count: 6600

Hi,

You can use the do_shortcode() function and add the ‘code A’ on the category template and use a condition like this to show it only if it’s a specify category using this method: https://forum.tagdiv.com/topic/block-widget-to-appear-in-one-category/#post-21306
You can do the same for the ‘code B’ which you want on other categories.
And use the method I suggested above using Advanced Custom Fields plugin to display ‘code B’ and/or ‘code A’ on posts template.
If you can’t manage to do this alone we recommend you to hire a freelancer to do it for you.

Thanks

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