Different Page Layout based on Category of Custom Post Type
-
I have a custom post type Portfolio and I want to display a different single post type layout based on the category. If its category “Superfoods” I want one layout if its any other category I want the default Portfolio post layout. Below is equivielant to what the code should be for different page layouts based on category, my question is there an exception or difference if its a custom post type? What am I missing?
<?php if (is_portfolio_category('Superfoods')) : ?> <h2>Super Food Elements</h2> <p><?php the_field('superfood-elements'); ?></p> <?php else : ?> <h2>Recipe Cooking Instructions</h2> <p><?php the_field('cooking-instructions'); ?></p> <?php endif; ?>
I took the code out for now but here is an example of a custom post type: https://renewingallthings.com/portfolio/detox-green-smoothie/
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Different Page Layout based on Category of Custom Post Type’ is closed to new replies.