Trips Plugin

Pure Charity Trips WordPress Plugin

A plugin to display trips from the Pure Charity app on your WordPress site.

It depends on the Pure Charity Base Plugin being installed and it’s credentials configured to work.

Installation

In order to install the plugin:

1. Download the plugin
2. Copy the `/purecharity-wp-trips` folder to the `/wp-content/plugins` on your WP install
3. Activate the plugin through the ‘Plugins’ menu in WordPress
4. You’re done!

Shortcodes

Trip Listing

No Trips Found.

Possible parameters:

  • country – The country to fetch trips from.
  • region – The region to fetch events from.
  • query – A search query for trips.
  • starts_at – YYYY-MM-DD date to only show trips that start after that date.
  • ends_at – YYYY-MM-DD date to only show trips that start before that date.
  • past – ‘true’ if you only want to show past trips.
  • include_past – ‘true’ if you want to include past events
  • upcoming – ‘true’ if you only want to show events starting in the future
  • tag – A tag to filter trips.
  • sort – Sort direction.

Single Trip


Possible parameters:

  • slug – The slug of the trip on the Pure Charity app.

Template Tags

Trip List

Function:

pc_trips()

Parameters:

The parameters are passed through an Object’s attributes.

 $options = new stdClass;
 $options->param = 'value';

Possible Attributes:

  • id – The ID of the trip you want to fetch.
  • per_page – The amount of trips to return per page.
  • country – The country to fetch trips from.
  • region – The region to fetch events from.
  • query – A search query for trips.
  • upcoming – set to true if you only want to show events starting in the future
  • tag – A tag to filter trips.
  • sort – Sort direction.

Returns:
A Trip “Object”

Return Object Attributes:

  • id – int
  • namestring
  • slug – string
  • about – string
  • description – string
  • region – string
  • category – string
  • country – string
  • field_partner_id – int
  • leaders – array of objects
    • id – int
    • name – string
    • public_url – string
  • tickets – array of objects
    • id – int
    • name– string
    • description – string
    • price – string
    • availability_starts_at – string(eg: 2014-07-28T15:57:08Z)
    • availability_ends_at – string(eg: 2014-07-28T15:57:08Z)
    • minimum_deposit – string(eg: 100.0)
    • public_url – string
  • registration_state – string
  • starts_at – string(eg: 2015-04-30T00:00:00Z)
  • ends_at – string(eg: 2015-04-30T00:00:00Z)
  • types – array of strings
  • images – object
  • large – string
  • medium – string
  • small – string
  • trip_tags – array of strings
  • public_url – string

Example (Show the name and description of a trip on your custom page):

 <?php $trip = pc_trip(201); ?>
 <h1><?php echo $trip->name ?></h1>
 <p><?php echo $trip->about ?></p>

Single Trip Information

Function:

pc_trip($id)

Parameters:

  •  $id – The ID of the trip you want to fetch.

Returns:
A Trip “Object”

Return Object Attributes:

  • id – int
  • name – string
  • slug – string
  • about – string
  • description – string
  • region – string
  • category – string
  • country – string
  • field_partner_id – int
  • leaders – array of objects
    • id – int
    • name – string
    • public_url – string
  • tickets – array of objects
    • id – int
    • name – string
    • description – string
    • price – string
    • availability_starts_at – string(eg: 2014-07-28T15:57:08Z)
    • availability_ends_at – string(eg: 2014-07-28T15:57:08Z)
    • minimum_deposit – string(eg: 100.0)
    • public_url – string
  • registration_state – string
  • starts_at – string(eg: 2015-04-30T00:00:00Z)
  • ends_at – string(eg: 2015-04-30T00:00:00Z)
  • types – array of strings
  • images – object
  • large – string
  • medium – string
  • small – string
  • trip_tags – array of strings
  • public_url – string

Example (Show a list of events):

 <?php $trips = pc_trips(); ?>
 <?php foreach($trips->events as $trip){ ?>
 <h1><?php echo $trip->name ?></h1>
 <p><?php echo $trip->about ?></p>
 <?php } ?>

Regions list

Function:

pc_trip_regions()

Returns:
A Regions “Object”

Return Object Attributes:

  • regions – array of objects
  • id – int
  • name – string

Example (Show a list of regions):

 <?php $regions = pc_trips_regions(); ?>
 <ul>
 <?php foreach($regions as $region){ ?>
 <li><?php echo $region->name ?></li>
 <?php } ?>
 </ul>

Countries list

Function:

pc_trip_countries()

Returns:
A Countries “Object”

Return Object Attributes:

  • regions – array of strings

Example (Show a list of countries):

 <?php $countries = pc_trips_countries(); ?>
 <ul>
 <?php foreach($countries as $country){ ?>
 <li><?php echo $country ?></li>
 <?php } ?>
 </ul>

Dates list

Function:

pc_trip_dates()

Returns:
An array of Dates

Return Object Attributes:

  • key – YYYY-MM format
  • value – Month YYYY format

Example (Show a list of dates):

 <?php $dates = pc_trips_dates(); ?>
 <ul>
 <?php foreach($dates as $date){ ?>
 <li><?php echo $date ?></li>
 <?php } ?>
 </ul>

Tags list

Function:

pc_trip_tags()

Returns:
A Tags “Object”

Return Object Attributes:

  • tags – array of strings

Example (Show a list of tags):

 <?php $tags = pc_trips_tags(); ?>
 <ul>
 <?php foreach($tags as $tag){ ?>
 <li><?php echo $tag ?></li>
 <?php } ?>
 </ul>