wordpress - Query based on menu -
i have menu (categories) set on wordpress , create query´s based on categories on menu, 1 query per menu item
- menu item 1
- menu item 2
- menu item 3
menu item 4
$args = array( 'category_name' => 'menu item 1');
$args = array( 'category_name' => 'menu item 2');
$args = array( 'category_name' => 'menu item 3');
$args = array( 'category_name' => 'menu item 4');
any ideas?
if you're speaking ordinary wp menu system, can grab menu data it's location this:
function custom_menu_output( $theme_location ) { if ( ($theme_location) && ($locations = get_nav_menu_locations()) && isset($locations[$theme_location]) ) { $menu = get_term( $locations[$theme_location], 'nav_menu' ); $menu_items = wp_get_nav_menu_items($menu->term_id); foreach( $menu_items $menu_item ) { $args = array( 'category_name' => $menu_item->title); //do query here & else } } }
Thanks for give us valuable information
ReplyDeleteContact WordPress Support
WordPress Support Service
Very Helpful. Thanks for such Information
ReplyDeleteWP Help
24x7 WP Support