• Resolved crystalcommerce

    (@crystalcommerce)


    I’ve installed my calendar here Battleground Games
    For some reason it will not display the month view, only the Event List.

    But I tracked down the problem, and it is in my left sidebar with the Popular Posts and Featured Post queries. In those queries I am calling query_posts(‘cat=3’) etc. And then I am resetting the query wp_reset_query(). but for some reason query_posts() is causing my calendar view to not display. When I remove just the query_posts() callout, it then returns the calendar view and it looks fine….

    I am using the default events theme listed in the settings as well. Anyone know how to solve this problem? Would be of great help, my client wants to purchase the PRO version but if I cannot figure this out then I will not.

    Thanks,

    Andy

    https://www.ads-software.com/extend/plugins/the-events-calendar/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hey Andy. Thanks for posting this, and sorry we haven’t hit the forum as often this past week as normal. (Gearing up for the 2.0.5 launch so we’re focused pretty heavily on that).

    When I just visited your site, I see that grid view is looking good. Can I assume that you’re all set, or do you have any lingering issues? I’ll keep watching this thread over the next day or two and will get you a response in a timely fashion if you’re still having issues. Let us know.

    Thread Starter crystalcommerce

    (@crystalcommerce)

    Hey Rob actually no I was not able to fix the issue, and am about to start delving into it more with another developer here. I merely commented out my query_posts() callout to allow the calendar view to show up. I believe your calendar will malfunction if a query_posts() callout is issued prior to your calendars embeded template. Even if the query is reset.

    I merely have a left navigation that is sitting before your calendar, in that sidebar I have some custom lists for posts, and when I call out the query_posts() function and reset the query it is causing your calendar view to default to list view, and once clicking the calendar view it will not change. Only when I remove the functions completely does the calendar begin to display properly.

    Please take a look at your template and add a query_posts() tag somewhere either in the header or before your calendar displays, and notice how it reacts to it. I am not a developer so sorry about my vague description of the problem.

    Let me know if you also see the problem on your end and if you find a solution, because if you do I will be using your calendar for most or all of my future clients.

    Thanks,

    Andy
    Crystal Commerce

    Gotcha – thanks for confirming, Andy. Let me get our dev Jonah to take a look as he’s more well-versed on the technical side than I am. Will get him to chime in directly.

    Hi Andy,

    Not quite sure why query_posts would be causing this issue but it appears to be fixed in 2.0.5 which is coming out in the next couple days. Have you tried WP_Query instead? WP_Query works for me in 2.0.4.

    Thread Starter crystalcommerce

    (@crystalcommerce)

    No I have not used it, I am very new with WordPress and PHP.
    Can you give me an example of it being used? Or send me to a page I can copy and paste an example from?

    Totally, it’s basically the same as using query_posts but slightly different. Here’s an example:

    <?php 
    
    	    $args = array(
    	       	'post_status'=>'publish',
    	       	'cat'=>7,
    	       	'posts_per_page'=>5,
    	        'orderby'=>'date'
    	    );
    	    $get_posts = null;
    	    $get_posts = new WP_Query();
    
    	    $get_posts->query($args);
    	    if($get_posts->have_posts()) : while($get_posts->have_posts()) : $get_posts->the_post(); ?>
    
    				<a href="<?php the_permalink(); ?>">
    				    <?php the_title(); ?>
    				</a>
    				<p><?php the_content(); ?></p>
    
    	<?php
    
    	    endwhile;
    	    endif;
    	    wp_reset_query();
    	?>

    You can just change the args to whatever you need in your query and change the markup for each post returned accordingly.

    Thread Starter crystalcommerce

    (@crystalcommerce)

    Nice this actually worked, thanks Johan and Rob.

    I will now purchase the PRO version!

    Andy
    [sig moderated as per the Forum Rules]

    Sweet, glad that worked!

    Excellent to hear. Thanks for the support, Andy ??

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: The Events Calendar] query_posts() Is breaking the calendar view’ is closed to new replies.