add tags and categories to pages like with posts
Hi
I would like to add the same tags and categories to my pages like I have on my posts. Then on my main menu I use the categories and both my page/posts that relate to that category automatically show when a user clicks on the category listing in the menu.
This is what i tried. 1) add to functions.php 2) added custom field to page. Neither tag nor category is associated to pages yet.
// add tag support to pages
function tags_support_all() {
register_taxonomy_for_object_type('post_tag', 'page');
}
// ensure all tags are included in queries
function tags_support_query($wp_query) {
if ($wp_query->get('tag')) $wp_query->set('post_type', 'any');
}
// tag hooks
add_action('init', 'tags_support_all');
add_action('pre_get_posts', 'tags_support_query');
On each page added
query_args (custom field name) cat=id of category (argument)
so if category is "great stuff" and id is 3 i added cat="3"
Appreciate any assistance. Thanks. Martha