show sticky posts only on homepage
-
I already found the code to show sticky posts only elsewhere on this site but I’m not sure how to integrate it correctly into the existing code.
Here is the loop code:
<?php $j = 0; if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } elseif ( get_query_var('page') ) { $paged = get_query_var('page'); } else { $paged = 1; } query_posts( array( 'post_type' => array('post','reviews'), 'paged' => $paged )); if (have_posts()) : while (have_posts()) : the_post(); ?>
…and here is the code for showing sticky posts:
<?php if (is_home()) { $stickies = get_option('sticky_posts'); if ($stickies) { query_posts(array_merge($wp_query->query, array('post__in' => $stickies))); } } ?>
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘show sticky posts only on homepage’ is closed to new replies.