Different Header for Post Categories

Hello!

Hopefully someone can help me out with this! I have already been able to edit my child theme’s function.php file to display a ‘Current Post’ Revolution Slide above_ my sidebar content as displayed here:

http://comdoc.wpengine.com/2017/03/02/xeroxs-global-imaging-systems-acquires-laser-resources/

I added this code to my functions.php to achieve this effect:
(Hopefully it helps someone in the future!)

//
// =============================================================================
// Slider revolution above header on post
// =============================================================================
//  

add_action('x_before_view_renew__landmark-header', 'custom_blog_header01');

function custom_blog_header01(){
    if (is_single()) {
  echo do_shortcode('[rev_slider alias="POST-Header"]');
}
 }

Currently, this works great and adds a Revolution Slider above all of my posts. Howerver, what I want to try doing is calling a different Revolution Slider (different design) based on post categories. Any chance someone can point me in the right direction?

Thank you in advance for any help! The support here is always great!

Hello @comdoc-marketing,

Thanks for asking. :slight_smile:

To output different slider for Category page you can use conditional statements that WordPress provided, which you have also used in the code. All you need to do is add the conditional tag in your code and replace Revolution Slider shortcode. For more information, please take a look at following resource.

https://codex.wordpress.org/Conditional_Tags#A_Category_Page

Yo many also require category id in case you want to target specific categories. To find out category id, please take a look at following article.

Please note that providing support for custom codes (like PHP changes) falls outside the scope of support we can offer. In case of any issues with the layout because of custom codes we won’t be able to provide support.

Thanks.

1 Like

Thank you so much! I should be able to figure it out from there.

Glad we were able to help :slight_smile:

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