Support » Plugin: The Events Calendar » [Plugin: The Events Calendar] Version 2.0 Query for Post Templates

  • Resolved holgee


    I updated the events calendar Plugin to Version 2.0 and everything works perfect – except the query of the events.

    Since the events became a custom post type, the query string must be updated. Actually i use this :

    <?php query_posts( array( ‘post_type’ => ‘tribe_events’,’posts_per_page’ => 4, ‘orderby’ => ‘date’, ‘order’ => ‘ASC’, ‘paged’ => $pagenum ));?>

    But i want to query only events whitch are in a special category i set up.

    So, to extend the query, i need the name of the taxonomy !

    <?php query_posts( array( ‘post_type’ => ‘tribe_events’, ‘? name ?’ => ‘name of the taxonomy i set up ‘ ) ); ?>

    many thanks for help !

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Rob La Gatta


    Thanks for the note on this. Let me get our dev John to take a look at this; I wouldn’t think that to have changed much, but he’d know better than I would. Sit tight and I’ll get you an answer on this shortly.

    Many thanks for your reply and your help !

    I tried also the following query but – it returns no value

    <?php query_posts( array('post_type' => 'tribe_events', 'category_name' => 'radio-shows', 'posts_per_page' => 4, 'order' => 'DESC'));?>

    “radio-shows” is the category i set up in the-events-kalendar tab in the admin panel.

    So, hopefully your dev John could help …

    Many thanks in advance !!!

    And also many thanks for this great plugin ! 😉

    Plugin Author Rob La Gatta


    Hey again. Spoke to John about this today; looks like category name won’t work because event categories aren’t normal categories. You would need to do a custom taxonomy query.

    Hey again and many thanks for your reply!

    It is clear that i have to do a custom taxonomy query – but for this i need the string or name was given by you – or am i wrong ?

    If i do this query :

    <?php query_posts( array('post_type' => 'tribe_events', 'Veranstalt.Kategorien' => 'radioshows', 'posts_per_page' => 4, 'order' => 'DESC'));?>

    “Veranstalt.Kategorien” is the german translation of the taxonomy given by you. But i think i need the engl. or “original” name for the query.

    Thanks in advance for your help and best regards


    I think it should be (not sure)
    ‘post_name’ => ‘your_category’,

    Hi, I just tried this out and it returns an “unresponsive script error” when I put it in the loop.

    <?php the_content(); ?>
    <?php query_posts( array('post_type' => 'tribe_events', 'post_name' => 'my-events-category-name'));?>
    <?php endwhile; ?>

    Any ideas?

    Hi …

    Seems to be a Firefox Problem ??!!!

    Or does the error appear in other browsers ?

    Hmm, Safari also crashes. I don’t think I have the right taxonomy name maybe? Maybe post_name is wrong?


    Give this a try:

    <?php $my_query = new WP_Query(array ('post_type' => array( 'Your Category Name Here', 'tribe_events' )  ) );
              while ($my_query->have_posts()) : $my_query->the_post();
              $do_not_duplicate[] = $post->ID ?>

    This is working for me and it would be really nice if the creators of this plugin could give some code examples. I’m honestly shocked at the above discussion, you ran off to ask your coder and returned with nothing. How about not keeping everything a mystery, especially if you want us to purchase the upgrade.

    Hi Doc! I will try that right now! Thanks for the code, and if it solves the problem I will let you know! I agree that the documentation is a bit vague for this plugin. Everything else about it works wonderfully, so why not provide a few more examples for the beginner/intermediates who want to use it? Thank you again!


    I may have spoken too soon. Seems this isn’t working correctly. I’m considering writing a short tutorial on my own website next week. This issue however is unsolved at the moment. I need to display a single category myself so if I find something I’ll post it here.

    Since we can’t seem to segregate using category, I’ve found a strange work around. Assign each category a specific author name and use this as a means to display a single category. Example below:

    <?php $my_query = new WP_Query(array ('post_type' => 'tribe_events', 'author' => 2  ) );
              while ($my_query->have_posts()) : $my_query->the_post();
              $do_not_duplicate[] = $post->ID ?>

    Tested and working, however I would rather use categories, this will work for my purposes now.



    You could try user handsomeman’s hack to expose regular categories for TEC event posts…

    Ahh, thanks Doc – unfortunately I need to make this as simple as possible for others who use the site so I think different authors would confuse them. I’ll keep looking.

    After a little “searching” in the deepth of the plugin folder, i found the workaround !!!!

    To Query a specific event – taxonomy i use this, and it works perfekt:

    <?php query_posts( array( ‘post_type’ => ‘tribe_events’, ‘tribe_events_cat’ => ‘YOR EVENT CAT’, ‘showposts’ => 4, ‘order’ => ‘ASC’ ) );
    if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>


    <?php endwhile; endif; wp_reset_query(); ?>

    Many thanks for your help and ideas !!!!


Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Plugin: The Events Calendar] Version 2.0 Query for Post Templates’ is closed to new replies.