Jak přidat tagy ke stránkám nebo stránky zařadit do rubriky

Možnost tagování stránek docílíme zaregistrováním příslušných *post_tag* a *category* taxonomií prostřednictvím funkce register_taxonomy_for_object_type function


// Add to the admin_init hook of your theme functions.php file
register_taxonomy_for_object_type('post_tag', 'page');
register_taxonomy_for_object_type('category', 'page');

která rovněž zobrazí příslušné metaboxy pro přidávání tagů a zařazení stránky do rubriky v administraci.

Abychom pak stránku v rámci přiřazené rubriky či tagů (štítků) zobrazili, přidáme do *functions.ph* filtr:


// Add to the init hook of your theme functions.php file
add_filter('request', 'my_expanded_request');  
 
function my_expanded_request($q) {
	if (isset($q['tag']) || isset($q['category_name'])) 
                $q['post_type'] = array('post', 'page');
	return $q;
}

ev. pluginem Tag Pages
http://wordpress.org/plugins/tag-pages/

This plugin adds the ‚post_tag‘ taxonomy to the Page post type. This enables the tags metabox in the New or Edit Page interface. To show tagged Pages on a tags archive page or in a feed, it uses the ‚pre_get_posts‘ hook to change the post_type query parameter to ‚any‘.