<?php if(in_category(3) && is_user_not_logged_in()){ ?>
Statistics: Posted by camillemm — September 13th, 2010, 4:13 am
Statistics: Posted by Jason Caldwell — September 9th, 2010, 10:40 am
Statistics: Posted by camillemm — September 9th, 2010, 8:27 am
global $query_string;
attach_s2member_query_filters();
/* Now re-query -> */ query_posts($query_string);
while (have_posts()): the_post();
... something, something
endwhile;
wp_reset_query();
detach_s2member_query_filters();
Statistics: Posted by Jason Caldwell — September 9th, 2010, 5:07 am
<?php
get_header();
attach_s2member_query_filters();
if (have_posts()) :
while (have_posts()) : the_post();
if (comicpress_in_comic_category()) {
if (!comicpress_themeinfo('disable_comic_blog_single')) {
comicpress_display_post();
$cur_date = mysql2date('Y-m-j', $post->post_date);
$next_comic = comicpress_get_next_comic();
if (!empty($next_comic)) {
$next_comic = (array)$next_comic;
$next_date = mysql2date('Y-m-j', $next_comic['post_date']);
}
$blog_query = 'showposts='.comicpress_themeinfo('blog_postcount').'&order=asc&cat='.comicpress_exclude_comic_categories();
}
} else {
comicpress_display_post();
}
comments_template('', true);
endwhile;
if (is_active_sidebar('blog')) get_sidebar('blog');
if (comicpress_themeinfo('static_blog') && comicpress_in_comic_category()) {
if (!comicpress_themeinfo('split_column_in_two')) {
$blog_query = 'showposts='.comicpress_themeinfo('blog_postcount').'&cat='.comicpress_exclude_comic_categories().'&paged='.$paged;
$posts = &query_posts($blog_query);
if (have_posts()) { ?>
<?php if (!comicpress_themeinfo('disable_blogheader')) { ?>
<div id="blogheader"><!-- This area can be used for a heading above your main page blog posts --></div>
<?php } ?>
<div class="blogindex-head"></div>
<div class="blogindex">
<?php while (have_posts()) : the_post();
comicpress_display_post();
endwhile; ?>
</div>
<div class="blogindex-foot"></div>
<?php }
comicpress_pagination();
} else {
comicpress_dual_columns();
}
} else {
if (comicpress_themeinfo('blogposts_with_comic')) {
$temppost = $post;
$temp_query = $wp_query;
if (comicpress_in_comic_category()) {
function filter_where($where = '') {
global $cur_date, $next_date;
if (!empty($next_date)) {
$where .= " AND post_date >= '".$cur_date."' AND post_date <= '".$next_date."'";
} else {
$where .= " AND post_date >= '".$cur_date."'";
}
return $where;
}
add_filter('posts_where', 'filter_where');
$posts = &query_posts($blog_query);
if (have_posts()) { while (have_posts()) : the_post();
comicpress_display_post();
comments_template('', true);
endwhile; }
}
$post = $temppost; $wp_query = $temp_query; $temppost = null; $temp_query = null;
}
}
else:
?>
<div <?php post_class(); ?>>
<div class="post-head"></div>
<div class="post">
<p><?php _e('Sorry, no posts matched your criteria.','comicpress'); ?></p>
<div class="clear"></div>
</div>
<div class="post-foot"></div>
</div>
<?php
endif;
wp_reset_query();
detach_s2member_query_filters();
if (is_active_sidebar('under-blog')) get_sidebar('underblog');
get_footer();
?>
<?php
get_header();
attach_s2member_query_filters();
if (!comicpress_themeinfo('disable_comic_frontpage') && !comicpress_themeinfo('disable_comic_blog_frontpage') && !is_paged() ) {
$wp_query->in_the_loop = true; $comicFrontpage = new WP_Query(); $comicFrontpage->query('showposts=1&cat='.comicpress_all_comic_categories_string());
while ($comicFrontpage->have_posts()) : $comicFrontpage->the_post();
comicpress_display_post();
endwhile;
wp_reset_query();
detach_s2member_query_filters();
}
if (is_active_sidebar('blog')) get_sidebar('blog');
if (!comicpress_themeinfo('disable_blogheader')) { ?>
<div id="blogheader"><?php echo comicpress_themeinfo('blogheader_text'); ?></div>
<?php
}
if (!comicpress_themeinfo('disable_blog_frontpage')) {
Protect();
if (!comicpress_themeinfo('split_column_in_two')) {
$paged = get_query_var('paged');
$blog_query = 'showposts='.comicpress_themeinfo('blog_postcount') .'&cat='.comicpress_exclude_comic_categories().'&paged='.$paged;
$posts = &query_posts($blog_query);
if (have_posts()) { ?>
<div class="blogindex-head"></div>
<div class="blogindex">
<?php while (have_posts()) : the_post();
comicpress_display_post();
endwhile; ?>
</div>
<div class="blogindex-foot"></div>
<?php }
comicpress_pagination();
} else {
comicpress_dual_columns();
}
UnProtect();
}
if (is_active_sidebar('under-blog')) get_sidebar('underblog');
get_footer();
?>
Statistics: Posted by camillemm — September 8th, 2010, 2:16 am
Statistics: Posted by camillemm — September 8th, 2010, 1:29 am
Statistics: Posted by camillemm — September 8th, 2010, 1:11 am
Statistics: Posted by Jason Caldwell — September 8th, 2010, 12:12 am
Example #1: Pre-filtering custom queries in WordPress®.
<?php
attach_s2member_query_filters();
query_posts("posts_per_page=5");
if (have_posts()):
while (have_posts()):
the_post();
/*
Protected content will be excluded automatically.
( based on the current User/Member status )
*/
endwhile;
endif;
wp_reset_query();
detach_s2member_query_filters();
?>
Example #2: OR, instead of pre-filtering; check Access Restrictions in The Loop.
<?php
detach_s2member_query_filters();
query_posts("posts_per_page=5");
if (have_posts()):
while (have_posts()):
the_post();
if(!is_permitted_by_s2member())
continue;
/* Skip it. The current User/Member has NO access. */
endwhile;
endif;
wp_reset_query();
?>
Statistics: Posted by Elizabeth — September 7th, 2010, 10:42 am
Statistics: Posted by camillemm — September 7th, 2010, 5:24 am