Created
November 26, 2012 07:18
-
-
Save tobedoit/4147001 to your computer and use it in GitHub Desktop.
Wordpress: sticky posts arrange first in category archive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php } elseif ( is_category('6') ) { // !카테고리 공지사항 ?> | |
<?php // get the current category | |
$category = get_the_category(); | |
// get the sticky post in the category | |
query_posts(array( 'post__in' => get_option('sticky_posts'), 'cat' => ''.$category[0]->cat_ID.'' )); | |
if (have_posts()) : while (have_posts()) : the_post(); | |
get_template_part('includes/entry', 'index'); | |
endwhile; endif; | |
query_posts(array( 'post__not_in' => get_option('sticky_posts'), 'cat' => ''.$category[0]->cat_ID.'' ) ); | |
if (have_posts()) : while (have_posts()) : the_post(); | |
get_template_part('includes/entry', 'index'); | |
endwhile; | |
if (function_exists('wp_pagenavi')) { wp_pagenavi(); } | |
else { get_template_part('includes/navigation','entry'); } | |
else: | |
get_template_part('includes/no-results','entry'); | |
endif; ?> | |
<?php } else { // !공지사항이 아니면 ?> | |
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> | |
<?php get_template_part('includes/entry', 'index'); ?> | |
<?php | |
endwhile; | |
if (function_exists('wp_pagenavi')) { wp_pagenavi(); } | |
else { get_template_part('includes/navigation','entry'); } | |
else: | |
get_template_part('includes/no-results','entry'); | |
endif; ?> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment