Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wordpress : how to add categories and tags on pages?

Tags:

wordpress

I have generated pages using a custom template by creating a php file in my theme directory something like :

<?php  *  * Template Name: Contact Page  */  ?>  <html ..... </html> 

and then adding a new page on the dashboard selecting this new template

How can i now associate tags and categories to each pages ? Is creating posts instead of pages the only solution?

like image 620
Matoeil Avatar asked Jan 14 '13 17:01

Matoeil


People also ask

Can I add categories to pages in WordPress?

To add a category, head over Pages » Categories from your WordPress dashboard and then enter a 'Name' and 'Slug' for your category. After that, you can scroll down and select a 'Parent Category' for your category. Once you've entered these details, simply click the 'Add New Category' button.


1 Answers

Even better is to add to functions.php in your theme folder:

function myplugin_settings() {       // Add tag metabox to page     register_taxonomy_for_object_type('post_tag', 'page');      // Add category metabox to page     register_taxonomy_for_object_type('category', 'page');   }  // Add to the admin_init hook of your theme functions.php file  add_action( 'init', 'myplugin_settings' ); 
like image 130
Matoeil Avatar answered Sep 27 '22 20:09

Matoeil