Filter a page by categories

Wanted to filter a page to only show specified categories from the blog.
This is how I did it!
1. Copy the template page and renamed it.
2. Modifie the .php file with the following.

<!--?php if (have_posts()) : ?-->
  <!--?php while (have_posts()) : the_post(); ?-->
    <!-- Filtering the page to only show CATEGORY_NAME1 and CATEGORY_NAME2 -->
    <!--?php if (in_category(array("CATEGORY_NAME1","CATEGORY_NAME2"))) : ?-->
      <!--... do what you want-->

    <!--?php endif; ?-->
    ...
    ...
    ...
Posted in Uncategorized, WordPress

Leave a Reply