Skip to content

For Developers: Sermon Post Type

Dave Mackey edited this page Jan 28, 2020 · 1 revision

The sermon post type is the center of this plugin's functionality. The post-type has several associated taxonomies and custom fields for building out your sermon archive.

GC Sermons comes with a GCS_Sermon_Post WP_Post wrapper class specifically for posts in the Sermon post-type.

You can get an instance of this class using the gc_get_sermon_post( $post_id ) helper function.

Get the Sermon Object

$sermon = gc_get_sermon_post( $sermon_identifier );

  • $sermon_identifier can use $sermon->ID, $sermon->post_name, $sermon->post_date, etc. All of these works as normal WP_Post parameters.

Get Video (Wrapper)

$video_player = $sermon->get_video_player( $args = array() );

Get Audio (Wrapper)

$audio_player = $sermon->get_audio_player();

Get Permalink (Wrapper)

$permalink = $sermon->permalink();

Get the Sermon Title (Wrapper)

$title = $sermon->title();

Get the Excerpt (Wrapper)

$excerpt = $sermon->loop_excerpt();

Get the Featured Image for Sermon

$featured_image = $sermon->featured_image( $size = 'full', $attr = '' );

  • $size - Optional. Image size to use; accepts any valid image size or an array of width and height values in pixels.
  • $attr - Option. Query string or array of attributes.

Get the Series Image

$series_image = $sermon->series_image( $size = 'full', $attr = '' );

  • Uses same parameters as above.

Get Single Speaker for This Sermon

$speaker = $sermon->get_speaker( $args = array() );

  • $args = Passed to GCS_Taxonomies_Base::get().

Get Single Series for This Sermon

$sermon = $sermon->get_series( $args = array() );

  • $args = Same as above.

Get other Sermons in the Same Series

$others_in_series = $sermon->get_others_in_series( $args = array() );

  • $args - Array of WP_Query arguments.

  • Returns: WP_Query instance.

Get Other Sermons by the Same Speaker.

$others_by_speaker = $sermon->get_others_by_speaker( $args = array() );

  • $args - Array of WP_Query arguments.

  • Returns: WP_Query instance.

Get Series Terms (Wrapper)

$series = $sermon->series();

  • Wraps: get_the_terms
  • Returns: Array of series terms

Get Speakers (Wrapper)

$speakers = $sermon->speakers();

  • Wraps: get_the_terms
  • Returns: Array of speaker terms

Get Topic Taxonomy (Wrapper)

$topics = $sermon->topics();

  • Wraps: get_the_terms
  • Returns: Array of topic terms

Get Tag Taxonomy (Wrapper)

$tags = $sermon->tags();

  • Wraps: get_the_terms
  • Returns: Array of tag terms

Get Sermon Meta (Wrapper)

$meta = $sermon->get_meta( $key );

  • $key - Required. Key of desired meta data.
  • Wraps: get_post_meta
  • Returns: Value of sermon meta