Homepage customization / including upcoming and past events

Home Forums Calendar Products Events Calendar PRO Homepage customization / including upcoming and past events

Viewing 15 posts - 16 through 30 (of 34 total)
  • Author
    Posts
  • #10979
    Adam
    Member

    One other addendum I realized I should mention sooner rather than later: my understanding is that getting posts this way produces “static” posts, i.e. they lack pagination. But I did have (and need) this for the homepage so people can click back and see that there is a rich history of events. This was no problem with query_posts, but can I also have that with the $upcoming and $past queries?

    #11000
    John
    Member

    Hi Adam,

    The December post isn’t showing up because tribe_get_events is using the system’s default posts_per_page option. You can add ‘posts_per_page’=>-1 to show all upcoming events.

    As far as pagination goes, it generally doesn’t work with get_posts. We are hoping to implement a custom pagination solution in an upcoming release.

    #11006
    Adam
    Member

    Thanks John – but the issue is actually that the upcoming and past events loops show the same events, no difference in the output. (I think I made some tweaks to the code since the time when that was the issue…)

    Here is the code:

    http://pastebin.com/5yrfpesH

    And here is what shows up:

    http://designerblowout.ca/blowout

    #11032
    Adam
    Member

    Hey… guys. My client’s limping along with a broken 1.6.5 site and I REALLY need your help to get 2.0.1 working.

    To reiterate where I’m at now, I just need the “full” code (fragments without context are not really helpful) to loop twice through events, once showing upcoming events and once showing past events. As well, I need to be able to display posts from particular categories on various e-newsletter templates.

    For the first issue, I tried (as an alternate to what’s in the pastebin link above) copying the entire code from list.php into my home.php page to grab upcoming events, but there it tells me “no upcoming events”. When I go to the regular link for upcoming events though, I do see the correct list.

    FYI, I am trying to learn what I can on my own – I found this article very promising, but at the end I still don’t know why my two loops are producing the same results:

    http://digwp.com/2011/05/loops/

    Five minutes of your undivided attention would be all it takes, I’m sure. I can also be available any time for a quick email or phone exchange. Let me know. I’m really in a corner here. Thanks!

    #11053
    Rob
    Member

    Hey Adam. Thanks for the note. I totally understand your position and am working to get someone on the team to respond today. Just as a heads up, we’re a small shop and I’m the only full-on dedicated support person; John & Jonah help out throughout the week but they are not on full-time so don’t hit every thread every day. Given our setup we’re unfortunately not in a position where we can be providing continuous support at much faster a rate than we do now.

    This being said, I do feel your pain and I’ve got this back on John’s plate, & have asked our other developer Jonah to take a look as well. (I’d offer my services as well but am unfortunately not a developer). I know Jonah is on today so if he can add anything else here you can expect a response this afternoon…otherwise I’ll need to circle up with John which likely won’t be until tomorrow.

    #11054
    Adam
    Member

    Thanks Rob for the quick reply. I totally get that you guys have limited resources and definitely appreciate the help you are able to provide. I’ll sit tight and wait for some more assistance.

    Hopefully down the road much of this can be included in the documentation – along with nice clear example PHP code… assuming that my situation is just a matter of learning “how to” and isn’t some kind of bug or technical problem (hope not!).

    Again, many thanks and looking forward to getting this sorted out.

    #11061
    Jonah
    Participant

    Hi Adam,

    It looks like the code you were using from Pastebin above had bad single quotes that was not properly passing the upcoming and past arguments to the query. If you fix the single quotes, it works. See here: http://pastebin.com/GhbcrssP

    Let me know if you need anything else.

    Regards,
    Jonah

    #11075
    Adam
    Member

    Thanks a million Jonah! Figures it would be something totally minor like that. D’OH!

    That leaves only one roadblock remaining for me: can you advise on how to query for events that are in particular categories? I’ve defined “featured” and “mailout” categories, for example – both used in custom templates I created for newsletter mailouts. In the previous version of the plugin I could just query_posts for posts checked with these categories. How can I specify that now?

    #11081
    Rob
    Member

    Excellent to hear Jonah was able to help you out here, Adam. I’ll get him to nail down this final bit for you either tonight or tomorrow morning, so we’ve got it ironed out.

    #11082
    Rob
    Member

    Excellent to hear Jonah was able to help you out here, Adam. I’ll get him to nail down this final bit for you either tonight or tomorrow morning, so we’ve got it ironed out.

    #11092
    Jonah
    Participant

    Hey Adam,

    You’re welcome!

    Since ECP and TEC use taxonomies for categories you’ll need to include taxonomy arguments in your query like so:


    $upcoming = tribe_get_events( array('eventDisplay'=>'upcoming', 'posts_per_page'=>-1, 'tax_query'=>array(array('taxonomy'=>'tribe_events_cat','field'=>'id','terms'=>3))));

    Where ‘terms’ is the ID of your category (really your taxonomy). You can also change ‘field’ to slug and use the slug of the category instead.

    More details on querying by taxonomies is here: http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

    That should do it for you but let me know if you need any other help with this.

    Regards,
    Jonah

    #11157
    Adam
    Member

    Thanks again Jonah! However, I’m trying to utilize your code and it simply returns all upcoming events, not just the ones in (in this case) the “selected” category. I tried:


    $upcoming = tribe_get_events( array('eventDisplay'=>'upcoming', 'posts_per_page'=>-1, 'tax_query'=>array(array('taxonomy'=>'tribe_events_cat','field'=>'id','terms'=>5))));

    Where the category is #5.

    I also tried this based on the codex article, using “array (‘name-of-category’)”:


    $upcoming = tribe_get_events( array('eventDisplay'=>'upcoming', 'posts_per_page'=>-1, 'tax_query'=>array(array('taxonomy'=>'tribe_events_cat','field'=>'id','terms'=>array ('selected')))));

    But that provides no results at all.

    Just for fun, here’s a link to the entire code: http://pastebin.com/zRk8YKU8

    And the page in question: http://designerblowout.ca/mailout-selected

    Hope you can point me toward my error! 8^)

    #11158
    Jonah
    Participant

    Hey Adam,

    Where’s your query for past events like you had before? You don’t have it in the code and that’s why you’re not seeing past events anymore. You’re only querying your upcoming events. The example I gave was just for your upcoming events but you’ll want to do the same thing for listing your past events.

    Upcoming:

    $upcoming = tribe_get_events( array('eventDisplay'=>'upcoming', 'posts_per_page'=>-1, 'tax_query'=>array(array('taxonomy'=>'tribe_events_cat','field'=>'id','terms'=>3))));

    Past:

    $past = tribe_get_events( array('eventDisplay'=>'past', 'posts_per_page'=>-1, 'tax_query'=>array(array('taxonomy'=>'tribe_events_cat','field'=>'id','terms'=>4))));

    Make sense?

    Regards,
    Jonah

    #11164
    Rob
    Member

    Thanks Jonah!

    #11168
    Adam
    Member

    So sorry Jonah, looks like your code is indeed working like a charm! I jumped to a wrong conclusion when I was checking the page. It’s fine! Thanks again!

    (BTW I do have the query in there on line 66… this is for a different page, a newsletter that only lists upcoming events.)

    All the best!

Viewing 15 posts - 16 through 30 (of 34 total)
  • The topic ‘Homepage customization / including upcoming and past events’ is closed to new replies.