Hard code in most recent one event in one category into page?

Home Forums Calendar Products Events Calendar PRO Hard code in most recent one event in one category into page?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #40969
    Andrea
    Participant

    Hi! I’d like to have my page auto-populate the one most recent upcoming event in the category of music into my page, which has a custom background.
    http://306phoenixhouse.com/music/
    Is this possible? Thanks!

    #41075
    Jonah
    Participant

    Hi Andrea,

    Take a look at the second example using tribe_get_events() here: https://theeventscalendar.com/support/documentation/the-events-calendar-template-tags-general-functions/#functiontribe_get_events – if you change it something like this (http://snippi.com/s/taj5x5m) that should work for you.

    Let me know whether or not that works.

    Regards,
    – Jonah

    #43537
    Andrea
    Participant

    Thanks so much for the quick response! Sorry I have only just gotten back to this……
    Can you advise on where to put the php? I’m looking to insert this info into just one page.
    Thank you for your ongoing support!
    Andrea

    #43727
    Jonah
    Participant

    Hi Andrea,

    I can’t tell you exactly where to put it, but generally you might try putting it in your theme’s page.php. Also, if you only want it on one page you’ll need to use a conditional statement in page.php like:

    if(is_page('your-page-slug') {
    //run the code
    }

    Does that help?

    – Jonah

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Hard code in most recent one event in one category into page?’ is closed to new replies.