-
Notifications
You must be signed in to change notification settings - Fork 1
MDG_Generic
Contains methods/properties that can be used by all classes.
All classes should at the very minimum extend MDG_Generic so they can have easy access to all helper methods/properties.
- Class name: MDG_Generic
- Namespace:
Void MDG_Generic::\MDG_Generic::__construct()()
Class Constructor
- Visibility: public
boolean MDG_Generic::\MDG_Generic::is_localhost()()
Checks if the current host is localhost.
- Visibility: public
boolean MDG_Generic::\MDG_Generic::is_staging()()
Checks if the current host is a staging site.
- Visibility: public
integer MDG_Generic::\MDG_Generic::get_id_by_slug()(string $slug)
Retrieves a page/post/custom post type ID when provided a slug.
- Visibility: public
- $slug string - <p>The slug of the page/post/custom post type you want an ID for.</p>
Void MDG_Generic::\MDG_Generic::make_dummy_content()(string $post_type, string $title, integer $count, array $options)
Adds testing post content to the supplied post type.
- Visibility: public
- $post_type string - <p>Required, Name of the post type to create content for.</p>
- $title string - <p>Required, The title base you want to use without a trailing space, the post count will be appended to the end.</p>
- $count integer - <p>Required, The amount of posts you want to be added.</p>
- $options array - <p>Optional, options to customize post generation.</p>
string MDG_Generic::\MDG_Generic::truncate_string()(string $string, integer $limit, string $break, string $pad)
Truncates a string with the supplied information
Example: global $mdg_generic; $mdg_generic->truncate( $string, 30, " " )
- Visibility: public
- $string string - <p>The string to be truncated</p>
- $limit integer - <p>The length of the truncated string</p>
- $break string - <p>The break point</p>
- $pad string - <p>The string padding to use</p>
string MDG_Generic::\MDG_Generic::pagination()(string $max_num_pages, integer $range, boolean $output)
Creates and optionally outputs pagination
- Visibility: public
- $max_num_pages string - <p>Optional. The amount of pages to be paginated through, defaults to the global $wp_query->max_num_pages.</p>
- $range integer - <p>Optional. The minimum amount of items to show</p>
- $output boolean - <p>Optional. Output the content</p>
\[type] MDG_Generic::\MDG_Generic::get_youtube_id()(string $embed)
Retrieves the YouTube video ID from the supplied embed code
- Visibility: public
- $embed string - <p>YouTube embed code</p>
array MDG_Generic::\MDG_Generic::clean_multi_input()(string $multi_input)
Cleans the multi input meta field.
- Visibility: public
- $multi_input string - <p>The multi input meta value.</p>
array MDG_Generic::\MDG_Generic::group_multi_input()(string $multi_input)
Groups the multi input meta field.
- Visibility: public
- $multi_input string - <p>The multi input meta value.</p>
integer MDG_Generic::\MDG_Generic::get_attachment_id_from_src()(string $attachment_url)
Get attachment ID from src url
- Visibility: public
- $attachment_url string - <p>Absolute URI to an attachment</p>
Determines whether or not to display the sidebar based on an array of conditional tags or page templates.
If any of the is_* conditional tags or is_page_template(template_file) checks return true, the sidebar will NOT be displayed.
- Class name: MDG_Sidebar
- Namespace:
private array $conditionals
WordPress conditional tags to check against.
- Visibility: private
private array $templates
Page template checks (via is_page_template())
- Visibility: private
public boolean $display = true
If the sidebar should be displayed.
- Visibility: public
mixed MDG_Sidebar::\MDG_Sidebar::__construct()(array $conditionals, array $templates)
Class constructor.
- Visibility: public
- $conditionals array - <p>WordPress conditional tags to check against.</p>
- $templates array - <p>Page template checks (via is_page_template())</p>
boolean MDG_Sidebar::\MDG_Sidebar::check_conditional_tag()(string $conditional_tag)
Checks the supplied conditional tag.
- Visibility: private
- $conditional_tag string - <p>The conditional tag to check against.</p>
boolean MDG_Sidebar::\MDG_Sidebar::check_page_template()(string $page_template)
Checks the supplied page template.
- Visibility: private
- $page_template string - <p>Page template to check against.</p>