Advertisement
GochiSiyan

include child

Apr 13th, 2022
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. add_filter( 'theme_mod_nav_menu_locations', function ( $menu ) {
  2. if ( is_category() ) {
  3. $data = [];
  4. $cats = [0,0,0,0];//list of category id to change
  5. jnews_recursive_category(get_categories([
  6. 'include' => $cats,
  7. ]), $data);
  8. if ( in_array( get_queried_object(), $data ) ) {
  9. $menu = is_array( $menu ) ? $menu : array();
  10. $menu['navigation'] = 0;//the menu id you wish to assign to the category.
  11. }
  12. }
  13. return $menu;
  14. } );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement