コード例 #1
0
/**
 * Outputs the post format quote.
 *
 * @since 3.6.0
 */
function the_post_format_quote()
{
    echo get_the_post_format_quote();
}
コード例 #2
0
ファイル: post.php プロジェクト: ninnypants/WordPress
/**
 * Parse post content for pagination
 *
 * @since 3.6.0
 *
 * @uses paginate_content()
 *
 * @param object $post The post object.
 * @param bool $remaining Whether to parse post formats from the content. Defaults to false.
 * @return array An array of values used for paginating the parsed content.
 */
function wp_parse_post_content($post, $remaining = false)
{
    $numpages = 1;
    if ($remaining) {
        $format = get_post_format($post);
        if ($format && in_array($format, array('image', 'audio', 'video', 'quote'))) {
            // Call get_the_post_format_*() to set $post->split_content
            switch ($format) {
                case 'image':
                    get_the_post_format_image('full', $post);
                    break;
                case 'audio':
                    get_the_post_format_media('audio', $post, 1);
                    break;
                case 'video':
                    get_the_post_format_media('video', $post, 1);
                    break;
                case 'quote':
                    get_the_post_format_quote($post);
                    break;
            }
        }
    }
    if (strpos($post->post_content, '<!--nextpage-->')) {
        $multipage = 1;
        if ($remaining && isset($post->split_content)) {
            $pages = paginate_content($post->split_content);
        } else {
            $pages = paginate_content($post->post_content);
        }
        $numpages = count($pages);
    } else {
        if ($remaining && isset($post->split_content)) {
            $pages = array($post->split_content);
        } else {
            $pages = array($post->post_content);
        }
        $multipage = 0;
    }
    return compact('multipage', 'pages', 'numpages');
}
コード例 #3
0
/**
 * Set up global post data.
 *
 * @since 1.5.0
 *
 * @param object $post Post data.
 * @uses do_action_ref_array() Calls 'the_post'
 * @return bool True when finished.
 */
function setup_postdata($post)
{
    global $id, $authordata, $currentday, $currentmonth, $page, $pages, $format_pages, $multipage, $more, $numpages;
    $id = (int) $post->ID;
    $authordata = get_userdata($post->post_author);
    $currentday = mysql2date('d.m.y', $post->post_date, false);
    $currentmonth = mysql2date('m', $post->post_date, false);
    $numpages = 1;
    $page = get_query_var('page');
    if (!$page) {
        $page = 1;
    }
    if (is_single() || is_page() || is_feed()) {
        $more = 1;
    }
    $split_content = $content = $post->post_content;
    $format = get_post_format($post);
    if ($format && in_array($format, array('image', 'audio', 'video', 'quote'))) {
        switch ($format) {
            case 'image':
                get_the_post_format_image('full', $post);
                if (isset($post->split_content)) {
                    $split_content = $post->split_content;
                }
                break;
            case 'audio':
                get_the_post_format_media('audio', $post, 1);
                if (isset($post->split_content)) {
                    $split_content = $post->split_content;
                }
                break;
            case 'video':
                get_the_post_format_media('video', $post, 1);
                if (isset($post->split_content)) {
                    $split_content = $post->split_content;
                }
                break;
            case 'quote':
                get_the_post_format_quote($post);
                if (isset($post->split_content)) {
                    $split_content = $post->split_content;
                }
                break;
        }
    }
    if (strpos($content, '<!--nextpage-->')) {
        if ($page > 1) {
            $more = 1;
        }
        $multipage = 1;
        $pages = paginate_content($content);
        $format_pages = paginate_content($split_content);
        $numpages = count($pages);
    } else {
        $pages = array($post->post_content);
        $format_pages = array($split_content);
        $multipage = 0;
    }
    do_action_ref_array('the_post', array(&$post));
    return true;
}