I am attempting to use categories for pages (not posts) as a way of filtering child pages.
I am working towards having a 'Work' page that lists all its children, and each of these children will also have categories applied to them. Another sub menu will allow you to choose a category and only those child pages will be listed.
So far:
functions.php - Show categories meta box for pages
function myplugin_settings() {
register_taxonomy_for_object_type('category', 'page');
}
add_action( 'init', 'myplugin_settings' );
Set up a category menu, which is rendered on my 'work' page
<?php wp_nav_menu(array('theme_location' => 'category-menu')); ?>
category.php - Get the ID of the category we're looking at
<?php get_header(); ?>
<?php $cat_id = get_cat_id( single_cat_title("",false) ); ?>
<p>
<?php echo $cat_id; ?>
</p>
<?php get_footer(); ?>
This is where I am stuck: How can I loop though my work child pages that have the category ID that I am getting in my category.php
template?
I understand that categories aren't really designed for pages so I am open to suggestions as to how to set and filter my pages by some kind of category.
I am already using Advanced Custom Fields so there is scope to use that; I would rather not use any other plugins.