How can I pull featured pics from events?

Home Forums Calendar Products Events Calendar PRO How can I pull featured pics from events?

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #41231
    aj
    Participant

    Howdy!

    I’m using an Elegant Theme’s theme to build a site that is relying on Ecents Calendar Pro to do the heavy lifting. There’s a little widget on the front page that displays thumbnail images (that expand lightbox-style when clicked) of featured images from selected categories. I’d really like to be able to pull the featured images from my events for this section.

    Warning and disclaimer: I’m a PHP noob. I know just enough to break the heck out of things I’m tinkering with, so I’d really prefer a copy/paste solution. That said, I’m willing to work through things if that’s what it takes. (After all, learnin’ is good, right? 😉 )

    Here’s the bit of code that I *think* I need to replace:
    $args=array(
    'showposts' => (int) get_option('chameleon_posts_media'),
    'category__not_in' => (array) get_option('chameleon_exlcats_media')

    But again, I’m not really certain about this. Thanks for any help you can give me with this!

    #41277
    Jonah
    Participant

    Hi aj,

    Can you paste the full code that the widget uses so I can take a look? You’re going to need to modify it’s query completely to include the events post type which is totally separate from other posts/categories.

    Please post the code to http://snippi.com/

    Thanks,
    Jonah

    #41520
    aj
    Participant

    Thanks for your response, Jonah! The code is here: http://snippi.com/s/bf8nkcj

    #41555
    Jonah
    Participant

    Hey aj,

    Try add this argument below the category__not_in like so:

    'showposts' => (int) get_option('chameleon_posts_media'),
    'category__not_in' => (array) get_option('chameleon_exlcats_media'),
    'post_type' => 'tribe_events'

    Does that work?

    – Jonah

    #41556
    Jonah
    Participant

    Ooop, actually make sure it reads like so to still include your other posts:

    'showposts' => (int) get_option('chameleon_posts_media'),
    'category__not_in' => (array) get_option('chameleon_exlcats_media'),
    'post_type' => array('tribe_events','post')

    #41581
    aj
    Participant

    Hi Jonah,

    Thanks for the response! That line did the trick!

    If we can, I’d like to take this two steps further (and then be done! forever!):
    – Step 1: I’d like to only display events from a particular category (probably something clever like “front-page-events”). Can we modify the above code to just grab that category?
    – Step 2: Right now that code produces a slider with thumbnails. When you click a thumbnail, you see a “lightbox” version of the image and a little description under the image. I’d like to make that description a link to the event page. Right now, the description gets printed out this way:

    How can I grab the URL for the event page so that I can do something like:
    <a href="">

    #41582
    aj
    Participant

    Bah! I got my code striped. I reposted it here: http://snippi.com/s/ifse2dn

    Thanks again (a lot!) for your help!

    #41597
    Jonah
    Participant

    Hey aj,

    That’s getting a little more involved than what we can help you with. You may need to hire someone to help you but here are some more tips. To pull events from specific categories, you need to add the following arguments:

    'tax_query'=> array(
    array(
    'taxonomy' => 'tribe_events_cat',
    'field' => 'slug',
    'terms' => 'conferences'
    )
    )

    Where ‘conferences’ is the name of your category or an array of categories like with the post_type arg. This is likely going to conflict with pulling in your regular posts into the slider though. You’ll probably have to add your regular post categories to the terms parameter to include them as well. For more info on the arguments you can pass into the query here, take a look at the WP_Query doco: https://codex.wordpress.org/Class_Reference/WP_Query

    For the link, you’ll probably want to use tribe_get_event_link() – take a look at our doco on that: https://theeventscalendar.com/support/documentation/the-events-calendar-template-tags-link-functions/#functiontribe_get_event_link

    I hope that helps!

    – Jonah

    #41604
    aj
    Participant

    Awesome. Thanks for your help, Jonah!

    #41622
    Jonah
    Participant

    You’re welcome aj, are you all set here then? Let us know if there’s anything else you need.

    – Jonah

    #978738
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘How can I pull featured pics from events?’ is closed to new replies.