Ejemplo n.º 1
0
/**
 * Displays quote markup.
 *
 * @since gp 1.0
 */
function gp_quote($post_id = null)
{
    if (null == $post_id) {
        $post_id = get_the_ID();
        if (!$post_id) {
            return false;
        }
    }
    $data = gp_quote_get_data($post_id);
    extract($data);
    if (!$quote) {
        return false;
    }
    $wrapping_class = array('wrap-quote', 'resizable', 'quote-' . $quote_color);
    if (is_single()) {
        $wrapping_class[] = 'quote-single';
    }
    $wrapping_class = ' class="' . join(' ', $wrapping_class) . '"';
    if ($quote) {
        ?>
        <div<?php 
        echo $wrapping_class;
        ?>
>
            <blockquote class="js-vertical-center">
                <p><span class="lq">&ldquo;</span><?php 
        echo $quote;
        ?>
</p>
                <?php 
        if ($quote_author && !empty($quote_author)) {
            ?>
                    <footer>
                        <cite><?php 
            echo $quote_author;
            ?>
</cite>
                    </footer><?php 
        }
        ?>
            </blockquote>
        </div><?php 
    }
}
Ejemplo 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;
}