WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Use different page layout if child category?

[Resolved] Use different page layout if child category?

  • I am modifying the category.php file to have 3 different layouts. One will be the standard layout for our theme, the other will be full-width, removing the sidebar if it is in the Articles category. I also need to the non-sidebar layout to be used on any child category of the Articles category. I can’t specify certain cat names or IDs in the category.php file because they won’t always be the same.

    Right now, my category.php file looks like this:

    <?php if (is_category( 'Articles' )): ?>
      /*non-sidebar content goes here*/
    <?php else: ?>
      /*regular category content goes here*/
    <?php get_sidebar(); ?>
    <?php endif; ?>
    <?php get_footer(); ?>

    I’ve done a search looking for how to do this, but haven’t been able to find anything. Thanks for the help!

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Use different page layout if child category?’ is closed to new replies.
Skip to toolbar