GithubHelp home page GithubHelp logo

eventpublisher's Introduction

EventPublisher

EventPublisher is simple Wordpress plugin that enables the publication of events via the Wordpress admin. It utilizes the jQuery UI datepicker and leverages Wordpress's custom post type features to create an Event post type in addition to Wordpress's built-in Posts and Pages.

Features

EventPublisher offers the following:

  • Creates an "Event" custom post type alongside Wordpress's "Posts" and "Pages."
  • Fields to house event title, event description, event location, event start date/time, and event end date/time. Users can assign a "Featured" event, in effect flagging the event for more prominent promotion on the front end.
  • Basic template tags for calling and displaying Events in your Wordpress theme templates.

Installation

  • Put the EventPublisher folder in your Wordpress site's wp-content/plugins/ directory.
  • Visit your site's Plugins manager page within the Wordpress admin (wp-admin/plugins.php)
  • Locate "Event Publisher" amongst the list of available plugins and click "Activate."

How to publish an event

  • Log in to your Wordpress site's admin (http://yoursite.com/wp-admin).
  • Locate and click "Events" in the menu within the left column.
  • Click "Add new."
  • Enter a title, description, event location, event start date/time, and event end date/time.
  • If you'd like to flag your event as "Featured," tick the Featured Event checkbox in the right column.
  • Click "Publish," just as you would with an normal Wordpress blog post.

How to display your events in your Wordpress theme templates

Upcoming Events

A basic example of how to call the list of upcoming events:

<ul class="upcoming-events">
<?php $events = ep_upcoming_events(); ?>
<?php foreach( $events->posts as $post ) : setup_postdata($post); ?>
    <?php
        $event_location = get_post_meta($post->ID, 'event_location', true);
        $start_date = get_post_meta($post->ID, 'start_date', true);
        $end_date = get_post_meta($post->ID, 'end_date', true);
    ?>
    <li>
        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
        <dl class="event-dates">
            <dt>Start Date:</dt>
            <dd><?php echo date('m/j/Y', strtotime($start_date)); ?></dd>
            <dt>End Date:</dt>
            <dd><?php echo date('m/j/Y', strtotime($end_date)); ?></dd>
        </dl>
        <address class="location"><?php echo $event_location; ?></address>
        <?php the_content(); ?>
    </li>
<?php endforeach; ?>
</ul>

Note that the maximum number of posts returned by ep_upcoming_events() is determined by your site's Reading settings (http://yoursite.com/wp-admin/options-reading.php)

Alternatively, to customize the number of events to display, use ep_get_events(). The following example returns the next 3 upcoming events:

<ul class="upcoming-events">
<?php $events = ep_get_events('upcoming', '3'); ?>
<?php foreach( $events as $post ) : setup_postdata($post); ?>
    <?php
        $event_location = get_post_meta($post->ID, 'event_location', true);
        $start_date = get_post_meta($post->ID, 'start_date', true);
        $end_date = get_post_meta($post->ID, 'end_date', true);
    ?>
    <li>
        <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
        <dl class="event-dates">
            <dt>Start Date:</dt>
            <dd><?php echo date('m/j/Y', strtotime($start_date)); ?></dd>
            <dt>End Date:</dt>
            <dd><?php echo date('m/j/Y', strtotime($end_date)); ?></dd>
        </dl>
        <address class="location"><?php echo $event_location; ?></address>
        <?php the_content(); ?>
    </li>
<?php endforeach; ?>
</ul>

Past Events

<?php $past_events = ep_past_events(); ?>

Alternatively, use ep_get_events() to customize the number of past events to display. The following example returns the first 3 past events:

<?php $past_events = ep_get_events('past', '3'); ?>

Featured Events

Calling the Featured events defaults to displaying the next upcoming Featured event:

<?php $featured_events = ep_featured_events(); ?>

eventpublisher's People

Contributors

mdb avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.