droidxn
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Plugins
In reply to: [Nextend Accordion Menu] Auto Expand to current pageThank you Romona (@nextend_ramona) that helped!
Forum: Fixing WordPress
In reply to: Get Categories from ‘Page’I will appreciate if someone could point me to the right direction. Thanks much for your interest.
Forum: Fixing WordPress
In reply to: Get Categories from ‘Page’Hi Michael,
The code below is in functions.php of my theme folder:
add_action( 'init', 'enable_tag_category' ); function enable_tag_category() { register_taxonomy_for_object_type('post_tag', 'page'); register_taxonomy_for_object_type('category', 'page'); }With the above code, I can see the “Tags” and “Categories” column when I go to Pages. Actually, when I hover over the “Pages” I can see Tags and Categories menu items.
Now to get the Categories and Tags that I have entered in the Pages, I have done this:
(The code below is at myTheme/page-templates/my-parent-page.php)$pages = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'post_date', 'sort_order' => 'asc' )); foreach( $pages as $page ){ $pageID = $page->ID; // there is where I tried the codes to get the Categories //$categories = wp_get_object_terms( $pageID, 'category', array('orderby' => 'term_id', 'hide_empty' => false) ); //$categories = get_object_taxonomies( $pageID, 'category' ); //$categories = get_terms(array('taxonomy' => 'category','hide_empty' => false)); //$categories = get_categories(); }
Viewing 3 replies - 1 through 3 (of 3 total)