• Resolved backpages

    (@backpages)


    We are using WordPress 4.3.1. We are using All-in-One Event Calendar 2.3.4. You can view our Calendar page here:

    https://www.watkins.edu/about/calendar/

    The calendar is being inserted twice into our page: once in the main content area and again in the sidebar. We only want it in the main content area.

    Additionally, many aspects of the calendar are not working. If you click the menu at the top to move from month to month, nothing happens. If you try to change the view from Agenda to Day, Month or Week, nothing happens. UNLESS, you hit refresh AFTER making one of the changes, then they take affect.

    Any guidance or help to getting these issues fixed would be greatly appreciated. Thank you very much!

    https://www.ads-software.com/plugins/all-in-one-event-calendar/

Viewing 15 replies - 1 through 15 (of 15 total)
  • Benjamin

    (@bsokic)

    Thread Starter backpages

    (@backpages)

    Thanks for the link, Benjamin. I will try that and see if it isolates the issue.

    kinna28

    (@kinna28)

    Because the calendar appears in:

    <nav id="applynav">
    <ul>
    <li><a href="/admissions/how-to-apply/">APPLY NOW</a></li>
    <li><a href="/admissions/request-info/">REQUEST INFO</a></li>
    <li><p>IMPORTANT DATES</p>
    <!-- START All-in-One Event Calendar Plugin - Version 2.3.4 -->
    <div class="ai1ec-main-container " id="ai1ec-container">
    <p>Jan 1, 2016<br>FAFSA processing begins</p>
    <p>March 1, 2016<br>Priority application and scholarship deadline</p>
    <p>July 15, 2016<br>Final application deadline</p>
    <div class="timely ai1ec-calendar" id="ai1ec-calendar">
    <div class="timely ai1ec-calendar-toolbar ai1ec-clearfix">
    ...
    </div>
    </div>
    </div>
    </li>
    </ul>
    </nav>

    What handles #applynav? Or its container, #navwrapper? As there’s no id or class on the li or p containing it, it could be a theme conflict with either of those two. Offhand, I can think of two ways: a shortcode coded into the navcontroller.php (whatever it’s named) or a calendar widget being inserted into the sidebar. It depends on whether it’s the widget or the shortcode being inserted in the area as they’re usually handled/fixed differently.

    Benjamin

    (@bsokic)

    Can you please provide a link to your calendar page.

    Thread Starter backpages

    (@backpages)

    Hi Kinna28: Thank you for your response. We are not using any shortcode or widget in the sidebar. That is what is so weird. The calendar appears on the page, where we are using shortcode, but it also appears in the sidebar and I can’t figure out why it appears there as well.

    Thread Starter backpages

    (@backpages)

    Thread Starter backpages

    (@backpages)

    OK, so I’ve made some progress sorting out the problem here. I’ve at least found the problem!

    In the sidebar for this page we use a WP_Query to pull in information about “Important Dates.” This information is in a post with an ID of 3180.

    When I remove that WP_Query the calendar works fine and is not being duplicated in the sidebar.

    Which is great, but we really need to pull in that other information in the sidebar and I don’t understand why it is conflicting with the calendar. For some reason when this query is run it is also pulling in the calendar content, along with the content for the important dates.

    Here is the code we are using to pull in the information for the sidebar. Any insight would be greatly appreciated! Thank you!

    <li><p>IMPORTANT DATES</p>
    
    <?php
    $new_query = new WP_Query( array( 'p' => 3180, 'posts_per_page' => 1) );
    ?>
    
    <?php
    if ( $new_query->have_posts() ) : while ($new_query->have_posts()) : $new_query->the_post();
    ?>
    
    <div id="theimportantdates"><?php the_content();?></div>
    
    <?php endwhile; else: endif; ?>
    
    <?php wp_reset_postdata(); ?>
    
    </li>
    kinna28

    (@kinna28)

    This looks like the query syntax might be causing the issue.

    What does 3180 reference? Is this a specific post of important dates? If this post ID doesn’t change, you could use get_post() instead of WP_Query(). If this is supposed to be a page instead of a post, you need to specify ‘post_type’ => ‘page’, or if it’s a custom post type, you need to specify that there.

    Keep in mind that this post ID should only point to a single event. If it’s pointing to the top event listed on your Calendar page, <?php the_content();?> is going to pull in all of the content it sees on the page, which is bringing in the entire calendar.

    The Codex has a terrifyingly large page on querying: https://codex.www.ads-software.com/Class_Reference/WP_Query#Post_.26_Page_Parameters

    However, it looks like you’re trying to pull in the top event listing? If, for example, you’re wanting to always show the most recent AI1EC event in the event category of ‘important’ you can do this:

    <li><p>IMPORTANT DATES</p>
    <?php $args = array(
    	'posts_per_page' => 1,
            'post_type' => 'ai1ec_event', // only event
            'tax_query' => array(
    		array(
    			'taxonomy' => 'category', // not sure if AI1EC uses a custom taxonomy for events?
    			'field'    => 'slug',
    			'terms'    => 'important', // you'd probably need to create a category in AI1EC for handling this, but would probably end up cleaner
    		),
             ),
    );
    $important_event = new WP_Query( $args ); ?>
    
    <?php if( $important_event->have_posts() ) {
       $important_event->the_post();
    }
    ?>
    
    <div id="theimportantdates">
    <?php the_content; ?>
    </div>
    
    <?php endif; ?>
    <?php wp_reset_postdata(); ?> // clear the queried post
    <?php wp_reset_query(); ?> // clear the query
    </li>
    Thread Starter backpages

    (@backpages)

    Hi kinna28, thanks for your response.

    The 3180 we are referencing in our code is a specific post. We are wanting to pull in the content from this post, and this post alone, to the sidebar area. We do not want anything related to the Calendar here. It is simply a static post with content. That is why I do not understand why it is also pulling in content from the Calendar. I will try using get_post() instead of WP_Query() and see if that makes any difference.

    Thread Starter backpages

    (@backpages)

    I have tried WP_Query, get_posts() and query_posts. In all cases, the content from the Calendar is pulled into the sidebar, even though I am specifically querying one single post, that with the ID of 3180. It is “the_content()” which is causing the conflict. If I just pull in “the_title()” it pulls the title from the 3180 post fine and everything is good. However, I need the content from this 3180 post to appear in the sidebar. Surely, there must be a way to do this. There appears to be some conflict with this Calendar system. Thanks again, for any help.

    Sorry to bother when its not my topic, but i have actually made a simulary topic today, but it seem like your found problem on your site, could you explain how ?

    Thread Starter backpages

    (@backpages)

    Svend, we simply ended up having to take the sidebar off the Calendar page so the content wouldn’t be duplicated twice.

    I was noticing this issue with some old theme queries using query_posts with a tag, just to retrieve a specific post.

    Modifying it to a WP_Query object with slightly more specific arguments (like ‘post_type’ => ‘post’) allowed me to use the_content without duplicate calendar being injected.

    Thread Starter backpages

    (@backpages)

    Hi schatzim, thanks for the response. Unfortunately, that doesn’t help for me. I’m using this code and it sill causes the calendar to be repeated under it.

    //The Query
    
    $args = array(
    	'post_type' => 'post',
            'p' => '3180',
    	'posts_per_page => 1'
    );
    
    $custom_posts = new WP_Query( $args );
    
    //The Loop
    if ( $custom_posts->have_posts() ) : while ($custom_posts->have_posts()) : $custom_posts->the_post();
    
    ?>
    
    <?php the_content(); ?>
    
    <?php endwhile; else: endif;
    
    //Reset Query
    wp_reset_query();

    I had this problem, until I realised using the shortcodes and adding the calendar to a page via the calendar config page was essentially doubling up.

    I removed the shortcode and all is good.

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Calendar Appearing Twice on Page and Certain Features Not Working’ is closed to new replies.