• Hi,

    firstly congratulations for the great job.

    i am just setting a Mega Menu plugin for a theme. It creates a custom Post Type called Mega Menu. Save and then inside a menu item you choose which mega menu to show for that menu.

    When i am in a page, mega menu content renders always the page i am in, and not the Mega menu post content.

    This only happens in pages, not in posts, i have tested to de-activate and activate the Site Origin panels for pages, posts, Mega menus..etc, all possible combinations but not working.

    Could someone guide me in the right direction to make this both plugins work together? I appreciatte your time and effort.

    Thank you very much for this great plugin.
    Best Regards

    https://www.ads-software.com/plugins/siteorigin-panels/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter mimo

    (@mimothemes)

    Hi again, i forgot to say that when i de-activate site Origin Panels, all works ok with the Mega Menus plugin so i think it may be some filter from Site Origin Panels Plugin to the content of the Mega Menu.

    Any ideas?
    Thank you very much.

    Plugin Author Greg Priday

    (@gpriday)

    Hi there Mimo. Thanks for letting me know about this issue. I’ve logged it in our issue tracker. I’ll try get it fixed in one of the upcoming updates.

    Thread Starter mimo

    (@mimothemes)

    Hi Greg, thank you very much for the attention. I have tested the Mage Menu plugin with other page builders and the problem persists so i think it has to be with the Mega menu plugin. it renders its content like this, i don’t know if you can guide me in the right direction to make it work.

    static function display_mega_menu_contents($output, $item, $depth, $args) {
    		$item = (array) $item;
    		$args = (array) $args;
    		if (empty($args['hide_mega_menu']) && $depth == 0 && empty($item['has_children'])) {
    			$mega_menu_id = get_post_meta($item['ID'], '_cf_mega_menu_id', true);
    			if (!empty($mega_menu_id) && ($mega_menu = get_post($mega_menu_id)) && !is_wp_error($mega_menu)) {
    				// We have a mega menu to display.
    				$wrapper_classes = apply_filters('cf-mega-menu-classes', array('cf-mega-menu', 'sub-menu'), $item, $depth, $args);
    				wp_reset_postdata();
    				setup_postdata($mega_menu);
    
    				ob_start();
    				the_content();
    				$contents = ob_get_clean();
    
    				if (!empty($contents)) {
    					$output .= '<ul class="' . esc_attr(implode(' ', $wrapper_classes)) . "\">\n";
    					$output .= $contents;
    					$output .= "</ul>\n";
    				}
    			}
    		}
    		return $output;
    
    	}

    If you quickly see anything that could be a problem please tell me if you have time.

    Thank you very much.
    Best Regards

    Try to remove all filters from the_content()
    remove_all_filters( 'the_content', 1 );
    and then add filters you need… something like this.

    add_filter('the_content', 'do_shortcode');
    $output .= apply_filters( 'the_content', $post->post_content );

    Not tested, just a quick guess.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘The_content conflict with mega menu’ is closed to new replies.