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 '
'.__('Close', 'carrington').'
'; } function cfct_ajax_post_comments($post_id) { global $post, $posts, $wp_query, $wp; $wp_query->is_single = true; $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); $wp->send_headers(); comments_template(); } function cfct_ajax_load() { if (isset($_GET['cfct_action'])) { switch ($_GET['cfct_action']) { case 'post_content': case 'post_comments': if (isset($_GET['id'])) { $post_id = intval($_GET['id']); } else if (isset($_GET['url'])) { $post_id = url_to_post_id($_GET['url']); } if ($post_id) { call_user_func('cfct_ajax_'.$_GET['cfct_action'], $post_id); die(); } } } } function cfct_ajax_comment_link() { global $post; echo ' rev="post-'.$post->ID.'" '; } add_filter('comments_popup_link_attributes', 'cfct_ajax_comment_link'); function cfct_posts_per_archive_page($query) { $count = get_option('cfct_posts_per_archive_page'); intval($count) > 0 ? $count = $count : $count = 25; $query->set('posts_per_archive_page', $count); if (is_category()) { $query->set('posts_per_page', $count); } return $query; } add_filter('pre_get_posts', 'cfct_posts_per_archive_page'); ?>