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         }     } } 

Comments

Post a Comment

Popular posts from this blog

filehandler - java open files not cleaned, even when the process is killed -

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -