-
Author
Tagged: woocommerce, main menu options, nav menu, product
-
August 28, 2015 at 09:20 #75016playismParticipant
Hello,
is there a way to enable “main menu options” box for product type, for some product pages, we want to display custom menus.
Thanks
August 28, 2015 at 13:12 #75034sharmstrModeratorPut this in your child theme’s functions.php file
COPY CODEadd_filter( 'kleo_meta_boxes', 'custom_kleo_metaboxes' ); /** * Define the metabox and field configurations. * * @param array $meta_boxes * @return array */ function custom_kleo_metaboxes( array $meta_boxes ) { // Start with an underscore to hide fields from custom fields list $prefix = '_kleo_'; //Custom menu $kleo_menus = wp_get_nav_menus(); $menu_options = array(); $menu_options[] = array('value' => 'default', 'name' => 'Site default'); foreach ($kleo_menus as $menu) { $menu_options[] = array('value' => $menu->slug, 'name' => $menu->name); } $meta_boxes[] = array( 'id' => 'page_menu', 'title' => 'Main menu options', 'pages' => array('product'), // Post type 'context' => 'side', 'priority' => 'default', 'show_names' => true, // Show field names on the left 'fields' => array( array( 'name' => 'Custom menu', 'desc' => '', 'id' => $prefix . 'page_menu', 'type' => 'select', 'options' => $menu_options, 'value' => 'default' ), array( 'name' => 'Hide Shop', 'desc' => 'Check to hide the Shop icon in the main menu', 'id' => $prefix . 'hide_shop_icon', 'type' => 'checkbox', 'value' => '1' ), array( 'name' => 'Hide Search', 'desc' => 'Check to hide the Search icon in the main menu', 'id' => $prefix . 'hide_search_icon', 'type' => 'checkbox', 'value' => '1' ), ), ); // Add other metaboxes as needed return $meta_boxes; }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionThis support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
The forum ‘KLEO’ is closed to new topics and replies.