Esempio n. 1
0
/**
 * Displays quote markup.
 *
 * @since gp 1.0
 */
function gp_video()
{
    global $post;
    if (!$post) {
        return;
    }
    $data = gp_video_get_data($post->ID);
    extract($data);
    if ($embed) {
        ?>
        <div class="wrap-embed-video">
            <?php 
        echo $embed;
        ?>
        </div><?php 
        return;
    }
}
Esempio n. 2
0
/**
 * Returns TRUE, if the post has any media assigned to it.
 * (eg. has a thumbnail, a video, quote...)
 *
 * @since gp 1.0
 */
function gp_post_has_media($post_id = false)
{
    $post_id = is_numeric($post_id) ? $post_id : get_the_ID();
    if (!$post_id) {
        return false;
    }
    if (has_post_thumbnail($post_id)) {
        return true;
    }
    $post_format = get_post_format($post_id);
    if ($post_format == 'quote') {
        $data = gp_quote_get_data($post_id);
        return isset($data['quote']) && !empty($data['quote']);
    }
    if ($post_format == 'link') {
        $data = gp_link_get_data($post_id);
        return isset($data['link']) && !empty($data['link']);
    }
    if ($post_format == 'video') {
        $data = gp_video_get_data($post_id);
        return isset($data['embed']) && !empty($data['embed']);
    }
    return false;
}