コード例 #1
0
ファイル: ajax-load.php プロジェクト: rascoop/carrington
function cfct_ajax_post_content($post_id)
{
    global $post, $posts, $wp_query, $wp;
    $posts = get_posts('include=' . $post_id);
    $post = $posts[0];
    if (is_null($post)) {
        $posts = get_pages('include=' . $post_id);
        $post = $posts[0];
    }
    if (is_null($post)) {
        $posts = get_posts('post_status=private&include=' . $post_id);
        $post = $posts[0];
        if ($post) {
            $user = wp_get_current_user();
            if (!$user->ID || $user->ID != $post->post_author) {
                $post = null;
            }
        }
    }
    if (!$post) {
        die('');
    }
    $wp_query->in_the_loop = true;
    setup_postdata($post);
    remove_filter('the_content', 'st_add_widget');
    $wp->send_headers();
    cfct_content();
    echo '<div class="close" id="post_close_' . $post_id . '"><a href="#">' . __('Close', 'carrington') . '</a></div>';
}
コード例 #2
0
ファイル: ajax-load.php プロジェクト: rascoop/carrington
function cfct_ajax_post_content($post_id)
{
    global $posts, $post;
    $posts = get_posts('include=' . $post_id);
    $post = $posts[0];
    setup_postdata($post);
    cfct_content();
}
コード例 #3
0
ファイル: ajax-load.php プロジェクト: rascoop/carrington
function cfct_ajax_post_content($post_id)
{
    global $posts, $post;
    $posts = get_posts('include=' . $post_id);
    $post = $posts[0];
    if (is_null($post)) {
        $posts = get_pages('include=' . $post_id);
        $post = $posts[0];
    }
    setup_postdata($post);
    remove_filter('the_content', 'st_add_widget');
    cfct_content();
}
コード例 #4
0
/**
 * Add markup to a post for AJAX display of post content
 * 
 * @return The markup for a close link
 * 
**/
function cfct_ajax_post_content($post_id)
{
    global $post, $posts, $wp_query, $wp;
    $post = get_post($post_id);
    // If the post wasn't found, or is not published or private, we're not interested.
    if (!is_object($post) || !in_array($post->post_status, array('publish', 'private'))) {
        die;
    }
    // If the post is private, make sure the user is allowed to see it before we show it.
    if ($post->post_status == 'private') {
        $user = wp_get_current_user();
        if (!$user->ID || !($user->ID == $post->post_author || current_user_can('editor') || current_user_can('administrator'))) {
            die;
        }
    }
    $wp_query->in_the_loop = true;
    setup_postdata($post);
    remove_filter('the_content', 'st_add_widget');
    $wp->send_headers();
    cfct_content();
    echo apply_filters('cfct_ajax_post_content_close', '<div class="close" id="post_close_' . $post_id . '"><a href="#">' . __('Close', 'carrington') . '</a></div>', $post_id);
}
コード例 #5
0
ファイル: page.php プロジェクト: rascoop/carrington
<?php

// This file is part of the Carrington Mobile Theme for WordPress
// http://carringtontheme.com
//
// Copyright (c) 2008-2010 Crowd Favorite, Ltd. All rights reserved.
// http://crowdfavorite.com
//
// Released under the GPL license
// http://www.opensource.org/licenses/gpl-license.php
//
// **********************************************************************
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// **********************************************************************
if (__FILE__ == $_SERVER['SCRIPT_FILENAME']) {
    die;
}
if (CFCT_DEBUG) {
    cfct_banner(__FILE__);
}
if (have_posts()) {
    while (have_posts()) {
        the_post();
        cfct_content();
    }
}