WordPress.org

Ready to get started?Download WordPress

Forums

The Events Calendar
[resolved] Version 2.0 Query for Post Templates (17 posts)

  1. holgee
    Member
    Posted 2 years ago #

    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 !

    http://wordpress.org/extend/plugins/the-events-calendar/

  2. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 2 years ago #

    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.

  3. holgee
    Member
    Posted 2 years ago #

    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 ! ;)

  4. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 2 years ago #

    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.

  5. holgee
    Member
    Posted 2 years ago #

    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

    Holger

  6. inTOWN
    Member
    Posted 2 years ago #

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

  7. katzw
    Member
    Posted 2 years ago #

    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?

  8. holgee
    Member
    Posted 2 years ago #

    Hi ...

    Seems to be a Firefox Problem ??!!!

    Or does the error appear in other browsers ?

    http://kb.mozillazine.org/Unresponsive_Script_Error

  9. katzw
    Member
    Posted 2 years ago #

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

  10. doc4
    Member
    Posted 2 years ago #

    katzw,

    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.

  11. katzw
    Member
    Posted 2 years ago #

    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!

  12. doc4
    Member
    Posted 2 years ago #

    katzw,

    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.

  13. doc4
    Member
    Posted 2 years ago #

    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.

  14. bwp
    Member
    Posted 2 years ago #

    You could try user handsomeman's hack to expose regular categories for TEC event posts...

  15. katzw
    Member
    Posted 2 years ago #

    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.

  16. holgee
    Member
    Posted 2 years ago #

    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(); ?>

    YOUR SPECIFIC POST CONTENT HERE

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

    Many thanks for your help and ideas !!!!

    Holger

  17. roblagatta
    Modern Tribe Support
    Plugin Author

    Posted 2 years ago #

    Excellent to see you got this figured out, holgee. Thanks to everyone for their thoughts on this along the way.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic