{"id":1189792,"date":"2016-11-09T10:16:20","date_gmt":"2016-11-09T18:16:20","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/"},"modified":"2016-11-09T13:08:55","modified_gmt":"2016-11-09T21:08:55","slug":"issue-with-calling-the_content-function","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/","title":{"rendered":"Issue with calling the_content() function"},"content":{"rendered":"<p>http:\/\/scrippscollege.staging.wpengine.com\/events\/calendar\/community\/add<\/p>\n<p>I have a function that calls the WordPress the_content() function, to populate my menu. It works fine on my all of my pages, except on the community event form page.<\/p>\n<p>When I call the the_content() function, it adds the community form to all my drop down menus.<\/p>\n<p>Here is my function<\/p>\n<p>function menu_system($menu) {<\/p>\n<p>if(!$menu) {<br \/>\n$menu = &#8216;9&#8217; ; \/\/ Defaults Menu selection to About if none provided<br \/>\n}<\/p>\n<p>global $wpdb; \/\/ Taps into the global WordPress variables<br \/>\n$wpdb_backup = $wpdb; \/\/ Copies the global WordPress variables for later<\/p>\n<p>global $switched;<br \/>\nswitch_to_blog(1); \/\/ Switches over to the blog requested<br \/>\nglobal $post;<\/p>\n<p>$args = array(<br \/>\n&#8216;page_id&#8217; =&gt; $menu, \/\/ Grabs the menu page we&#8217;re looking for<br \/>\n);<\/p>\n<p>$output = &#8221;; \/\/ Initialize the variable we&#8217;re going to use to hold our output<br \/>\n$menu_system = new WP_Query( $args ); \/\/ Select page we&#8217;re going to use<\/p>\n<p>if ( $menu_system-&gt;have_posts() ) {<br \/>\nwhile ( $menu_system-&gt;have_posts() ) {<br \/>\n$menu_system-&gt;the_post();<\/p>\n<p>$output = the_content();<\/p>\n<p>}<br \/>\n}<\/p>\n<p>wp_reset_postdata(); \/\/ Resets the WP_Query<br \/>\nrestore_current_blog(); \/\/ Restores the switch_to_blog() function<\/p>\n<p>$wpdb = $wpdb_backup; \/\/ Restores the global WordPress variables<\/p>\n<p>return $output; \/\/ Return our output to the page: Scripps College menus.<\/p>\n<p>}<\/p>\n","protected":false},"template":"","class_list":["post-1189792","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Issue with calling the_content() function -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Issue with calling the_content() function -\" \/>\n<meta property=\"og:description\" content=\"http:\/\/scrippscollege.staging.wpengine.com\/events\/calendar\/community\/add I have a function that calls the WordPress the_content() function, to populate my menu. It works fine on my all of my pages, except on the community event form page. When I call the the_content() function, it adds the community form to all my drop down menus. Here is my function function menu_system($menu) { [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/\" \/>\n<meta property=\"article:modified_time\" content=\"2016-11-09T21:08:55+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/\",\"name\":\"Issue with calling the_content() function -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-11-09T18:16:20+00:00\",\"dateModified\":\"2016-11-09T21:08:55+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Community Events\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/community-events\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Issue with calling the_content() function\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Issue with calling the_content() function -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/","og_locale":"en_US","og_type":"article","og_title":"Issue with calling the_content() function -","og_description":"http:\/\/scrippscollege.staging.wpengine.com\/events\/calendar\/community\/add I have a function that calls the WordPress the_content() function, to populate my menu. It works fine on my all of my pages, except on the community event form page. When I call the the_content() function, it adds the community form to all my drop down menus. Here is my function function menu_system($menu) { [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/","article_modified_time":"2016-11-09T21:08:55+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/","name":"Issue with calling the_content() function -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-11-09T18:16:20+00:00","dateModified":"2016-11-09T21:08:55+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/issue-with-calling-the_content-function\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Community Events","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/community-events\/"},{"@type":"ListItem","position":5,"name":"Issue with calling the_content() function"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1189792","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1189792\/revisions"}],"predecessor-version":[{"id":1189923,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1189792\/revisions\/1189923"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1189792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}