예제 #1
0
/**
 * Add attributes to post thumbnails to wire up play buttons in JavaScript.
 *
 * @since 1.1.0
 *
 * @todo This may need to be updated to retrieve the $post_id from
 *       huesos_audiotheme_enable_post_thumbnail_attributes_filter() if
 *       it gets called outside of a loop.
 *
 * @param array $attributes Post thumbnail image attributes.
 * @param WP_Post $attachment Attachment post object.
 * @return array
 */
function huesos_audiotheme_thumbnail_attributes($attributes, $attachment)
{
    global $huesos_post_id, $wp_query;
    // Records and tracks.
    if (in_array(get_post_type($huesos_post_id), array('audiotheme_record', 'audiotheme_track')) && huesos_player()->is_record_playable($huesos_post_id)) {
        $attributes['class'] .= ' js-playable';
        $attributes['data-post-id'] = $huesos_post_id;
        $attributes['data-type'] = 'record';
    } elseif (in_the_loop() && $wp_query->is_main_query() && is_post_type_archive('audiotheme_video') && 'audiotheme_video' === get_post_type($huesos_post_id)) {
        $attributes['class'] .= ' js-playable';
        $attributes['data-post-id'] = $huesos_post_id;
        $attributes['data-type'] = 'video';
    }
    return $attributes;
}
예제 #2
0
/**
 * Retrieve the site-wide player instance.
 *
 * @since 1.0.0
 *
 * @return Huesos_Player
 */
function huesos_player()
{
    static $instance;
    if (null === $instance) {
        $instance = new Huesos_Player();
    }
    return $instance;
}
add_action('init', array(huesos_player(), 'load'));
/**
 * Wrapper for accessing the Cedaro_Theme instance.
 *
 * @since 1.0.0
 *
 * @return Cedaro_Theme
 */
function huesos_theme()
{
    static $instance;
    if (null === $instance) {
        Cedaro_Theme_Autoloader::register();
        $instance = new Cedaro_Theme(array('prefix' => 'huesos'));
    }
    return $instance;