Skip to content

For Developers: Some Core Functions

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

These are unique functions to the Liquid Messages plugin. This does not include wrapper functions (functions that wrap built-in WP functionality under a different name).

  • functions.php
    • gc_get_sermon_post = Returns a specific message post, that is a GCS_Sermon_Post object from post object or ID.
    • gc_get_sermon_series_info = Returns a specific series taxonomy item.
    • gc_get_sermon_speaker_info = Returns a specific speaker taxonomy item.
    • gc_get_sermon_related_links = Returns the links related to a specific message post.!!
    • is_array_empty = Checks if an array is empty.
    • gc_get_sermon_video_player = Returns the message video attached to a specific message post.
    • gc_get_sermon_audio_player = Returns the audio message attached to a specific message post.!
    • gc_search_get_next_results_link = Gets the next search results page link which is used with the search widget.
    • gc_search_get_previous_results_link = Gets the previous search results page link which is used with the search widget.
    • gc__get_arg = A helper function for getting $_GET values with an optional default value.
  • gc-sermons.php
    • __construct = Sets up the plugin.
    • activate = Runs when the plugin is activated.
    • get_instance = Creates an instance of the class or returns an existing instance; but you should use gc_sermons instead (see below).
    • deactivate = Runs when the plugin is deactivated.
    • hooks = Adds hooks and filters. Specifically, it calls TGMPA if CMB2 or WDS_SHORTCODES is not loaded and if they are calls init.
    • plugin_classes = Attaches other plugin classes to the base plugin class: GCS_Sermons, GCS_Taxonomies, GCS_Async, GCS_Shortcodes.
    • register_required_plugin = Registers CMB2 as being a required plugin with TGMPA.
    • init = Init hooks, specifically to load the language file.
    • __get = A magic getter for our object.
    • gc_sermons = Grab and return the GC_Sermons_Plugin object, wraps GC_Sermons_plugin::get_instance().
  • includes\post-types\class-post-types-base.php (Abstract Class: GCS_Post_Types_Base which extends CPT_Core).
    • __construct = Registers the CPT.
    • filter_values
    • post_type = Provides access to protected class properties.
    • (abstract function) hooks = Initiate our hooks.
    • new_cmb2 = Wrapper for new_cmb2_box.
    • __get = Magic getter for our object.
  • includes\post-types\class-sermons.php
    • __construct = Registers custom post type of Sermon.
    • hooks = Initiates our hooks, in this case: cmb2_admin_init, cmb2_override_excerpt_meta_value, cmb2_override_excerpt_meta_save, and admin_init
      • It also applies the gc_do_sermon_series_fallback_image filter and the gc_display_future_sermsons filter (sp), the latter allows future posts to be displayed.
    • admin_hooks = Adds in dbx_post_advanced/remove_default_boxes_for_sermons, manage_edit-{$this->post_type()}_columns, manage_edit-{$this->post_type()}_sortable_columns, posts_clauses/columns_sort_func, wp_ajax_check_sermon_duplicate_video/check_sermon_duplicate_video, wp_ajax_nopriv_check_sermon_duplicate_video/check_sermon_duplicate_video.
    • check_sermon_duplicate_video = Checks if there is a duplicate post with the same video meta url.
    • remove_default_boxes_for_sermons = Removes default excerpt/featured image metaboxes for Messages.
    • featured_image_fallback_to_series_image = Uses the series image if a message image is not set.
    • save_future_as_published = When scheduled message is saved, changes status to publish, allowing future-date messages to show on front-end.
    • label_coming_soon
    • fields = Add custom fields to the CPT.
    • get_excerpt = Gets the post excerpt field.
    • columns - Registers admin columns to display.
    • columns_display = Displays admin columns.
    • columns_sortable = Enables sorting custom columns.
    • columns_sort_func = Sort functionality for custom columns.
    • admin_column_css = Outputs the CSS for custom admin columns.
    • most_recent_with_video = Returns most recent message w/video media.
    • most_recent = Returns the most recent message.
    • most_recent_with_media = Returns the most recent message with media.
    • most_recent_with_audio = Returns the most recent message with audio.
    • get = Returns a specific message.
    • get_many = Retrieves multiple messages.
    • most_recent_with_taxonomy = Returns most recent message with terms in specified taxonomy.
    • find_sermon_with_taxonomy = Searches for messages which have terms in a given taxonomy, excludes previous tries.
  • includes\class-async.php
    • __construct = Constructor.
    • prepare_data = Prepare data for the asynchronous request.
    • run_action = Run the async task action.
  • includes\class-sermon-post.php
    • __construct = Constructor
    • init_media = Initiate the video/audio media object.
    • add_media_type = Add media info to the media array for $type
    • get_video_player = Wrapper for wp_oembed_get/wp_video_shortcode.
    • get_audio_player = Wrapper for wp_audio_shortcode.
    • permalink = Wrapper for get_permalink.
    • loop_excerpt = Wrapper for the_excerpt.
    • featured_image = Wrapper for get_the_post_thumbnail which stores the results to the object.
    • featured_image_id = Wrapper for get_post_thumbnail_id.
    • series_image = Get the series image.
    • get_speakers = Get all speakers for this message.
    • get_speaker = Get a single speaker for this message.
    • get_series = Get a single series for this message.
    • get_scriptures = Get scripture for this message.
    • get_others_in_series = Get other messages in the same series.
    • get_others_by_speaker = Get other messages by same speaker.
    • series = Wrapper for get_the_terms for the series taxonomy.
    • scripture = Wrapper for get_the_terms for the scripture taxonomy.
    • speakers = Wrapper for get_the_terms for the speaker taxonomy.
    • topics = Wrapper for get_the_terms for the topic taxonomy.
    • tags = Wrapper for get_the_terms for the tag taxonomy.
    • init_taxonomy = Initiate the taxonomy passed in.
    • get_meta = Wrapper for get_post_meta.
    • __get = Magic getter for our object.
    • __isset = Magic isset checker for our object.
    • translate_property = Allow some variations on the object __getter
  • includes\class-style-loader.php
    • __construct = HTML view template loader constructor.
    • load = Loads the view and outputs it.
    • format_css_tag = Minifies css and wraps in style tag.
    • get_template = Gets a rendered HTMl view with the given arguments and returns the view's contents.
    • output_template = Render an HTML view with the given arguments and output the view's contents.
  • class-template-loader.php
    • __construct = HTML view template loader constructor.
    • load = Loads the view and outputs it.
    • locate_template = Retrieve the name of the highest priority template file that exists.
    • _locate = Searches for templates in (1) child theme, (2) parent theme, (3) this plugin.
    • get = Get one of the $args values.
    • output = Output one of the $args values.
    • maybe_output = Conditionally output one of the $args values, if the value (or another one specified) exists.
    • __toString = Magic method to fetch the rendered view when calling the call as a string.
    • get_template = Get a rendered HTML view with the given arguments and return the view's contents.
    • output_template = Render an HTML view with the given arguments and output the view's contents.

!We may want to deprecate this functionality, since we use additional resources instead. Alternatively, we could combine this with gc_get_sermon_video_player and add a parameter to specific whether video or audio is requested. !!We may also look at deprecating this functionality since we use Additional Resources.

Clone this wiki locally