DONE: Custom menu for every post in category
-
Hello guys! I discovered this plugin for my needs and made a little fix.
Now it’s enough to set the custom menu for a particular category (archive), and all the posts / pages that come with this category will get the same menu as the page of the category itself.
For example, you have a category:
site.com/cat1
You can set your own menu for this plugin, but when you go to any post / page in this category, you get a standard menu (I think maybe it’s a bug in the plugin or after the WordPress update). I corrected the situation, and now all posts will have the same menu as the category page. Works on WordPress 4.8.2To do this, go to the source code of the plugin wp-content/plugins/page-menu/pagemenu.php, find the lines:
if (is_archive()) { $t_id = $wp_query->get_queried_object_id(); $this->pgm_option = get_option("taxonomy_$t_id"); }
And add after them the code:
else if (is_single() OR is_page()) { // post id $p_id = $wp_query->get_queried_object_id(); // category data (may be few cats, we are getting menu only from 1st one) $cats = get_the_category($p_id); if ( ! empty( $cats ) ) { $cat_id = $cats[0]->term_id; } // parent category custom taxonomy if ($cat_id) { $this->pgm_option = get_option("taxonomy_$cat_id"); } }
- The topic ‘DONE: Custom menu for every post in category’ is closed to new replies.