Custom Single Post template selected by category

I would like to have single posts displayed differently, depending on their category; for instance, if the category is “news” they should display with a News Revslider above the masthead and a page title of “News”, but if the category is “blog” they should have no slider and a page title of “Wayne’s Blog”.

Is there a way to achieve this?

Thanks
Mike.

Hello Mike,

This would involve some customization to achieve which goes beyond the scope of our support.

But to get you started, you can make all the changes to the wp-single.php file which is the file template the blog page uses which you can find in wp-content/themes/x/framework/views/THE_STACK_YOU_ARE_USING.

Please make sure to do the changes through a child theme: https://theme.co/docs/child-themes so the customized wp-single.php should be in wp-content/themes/x/framework/views/global/THE_STACK_YOU_ARE_USING.

Then in the code, you can make use of the has_category function to check for the category of the post.

Hope this helps you get started.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.