Issue with calling the_content() function

Home Forums Calendar Products Community Events Issue with calling the_content() function

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1189792
    Jeff
    Participant

    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) {

    if(!$menu) {
    $menu = ‘9’ ; // Defaults Menu selection to About if none provided
    }

    global $wpdb; // Taps into the global WordPress variables
    $wpdb_backup = $wpdb; // Copies the global WordPress variables for later

    global $switched;
    switch_to_blog(1); // Switches over to the blog requested
    global $post;

    $args = array(
    ‘page_id’ => $menu, // Grabs the menu page we’re looking for
    );

    $output = ”; // Initialize the variable we’re going to use to hold our output
    $menu_system = new WP_Query( $args ); // Select page we’re going to use

    if ( $menu_system->have_posts() ) {
    while ( $menu_system->have_posts() ) {
    $menu_system->the_post();

    $output = the_content();

    }
    }

    wp_reset_postdata(); // Resets the WP_Query
    restore_current_blog(); // Restores the switch_to_blog() function

    $wpdb = $wpdb_backup; // Restores the global WordPress variables

    return $output; // Return our output to the page: Scripps College menus.

    }

    #1189922
    Cliff
    Member

    Hi Jeff.

    I’m not sure how I can help with your customization (which we cannot provide such in-depth help for, per our Scope of Support / Terms), but I can give you a few details about the Community Events form “page”… It’s not a page or a single custom post type or even an archive.

    It’s created via WP Router, which you can read a bit about at http://ben.lobaugh.net/blog/35542/wordpress-creating-new-routes-custom-urls-with-wp-router

    If you need some coding help, you may want to ask your developer or reference our documentation and list of known customizers.

    #1190446
    Jeff
    Participant

    I did a work around by installing ACF plugin and creating a custom field called “sub menu”. I then copy the content from the default description field into the new ACF field.

    #1190519
    Cliff
    Member

    I’m glad you got this sorted out. Thanks for letting me and others know about your workaround.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Issue with calling the_content() function’ is closed to new replies.