WordPress.org

Support

Support » Plugins and Hacks » Hotscot Events » [Resolved] Is there some documentation / how to I display events

[Resolved] Is there some documentation / how to I display events

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author huntlyc

    @huntlyc

    Hi ben,

    I’ve pushed an update to the plugin that can show a table of events with a link to the individual event pages. The shortcode is [ht_list_events numevents=1] where num events is optional to limit the amount of events being shown.

    If you’re comfortable with code and want to customize the output then then the following function may be of use to you:

    /**
     * getEvents - get events as object
     *
     * Will print a list of events either from the current date or one specified.  The end range can be specified or left blank to
     * show everything ending in the future.
     *
     * @param date start_date (yyyy-mm-dd) - Leave blank for today
     * @param date end_date (yyyy-mm-dd) [OPTIONAL]
     * @param limit - limit the number of posts
     * @return object of posts that relate to this query
     **/
    ht_getEvents($start_date = "", $end_date = "", $limit = 0)

    Here’s an example of how to show the title with start and end dates in a h1 tag using the default wordpress date format with the event excerpt:

    <?php $events = ht_getEvents(); ?>
    <?php if($events): ?>
        <?php foreach($events as $event): ?>
            <h1><?php echo $event->post_title; ?>(<?php echo date(get_option('date_format', 'd/m/Y'), strtotime($event->sdte)) . ' - ' . date(get_option('date_format', 'd/m/Y'), strtotime($event->edte)); ?>)</h1>
            <?php echo apply_filters( 'the_content', $event->post_excerpt ); ?>
        <?php endforeach; ?>
    <?php else: ?>
        <p>No upcoming events.</p>
    <?php endif; ?>

    Hope this helps!!

    Cheers,
    Huntly

    Very Slick!

    Thanks Very Much.

    Plugin Author huntlyc

    @huntlyc

    Your very welcome! I just wish that one day WordPress would notify me when someone starts a new forum topic on a plugins I contribute to!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Is there some documentation / how to I display events’ is closed to new replies.
Skip to toolbar