WordPress.org

Forums

Page Builder by SiteOrigin
The_content conflict with mega menu (5 posts)

  1. Mimo
    Member
    Posted 1 year ago #

    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://wordpress.org/plugins/siteorigin-panels/

  2. Mimo
    Member
    Posted 1 year ago #

    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.

  3. Greg Priday
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  4. Mimo
    Member
    Posted 1 year ago #

    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

  5. dariodev
    Member
    Posted 10 months ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Page Builder by SiteOrigin
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic