• Hi,

    I have created a custom query which displays News content in a specific area on the frontpage.

    I would like to be able to have the Sticky post feature work so that any “Sticky” posts remain at the top of the posts.

    How can I get this to work. This is the code I am currently using:

    $args = array(
    								'post_type' => 'post',
    								'category_name' => 'nashakaranews',
    								'posts_per_page' => 5,
    								//'post__in' => get_option('sticky_posts'),
    								'cat' => -270,
    							);
    							$query_news = new WP_Query( $args );
    							if ( $query_news->have_posts() ) {
    								echo '
    <ul>';
    								while ( $query_news->have_posts() ) {
    									$query_news->the_post();
    									echo '
    <li>';
    										?>
    										<a>" title="<?php the_title(); ?>">
    										<?php
    										the_post_thumbnail( 'event' );
    										?></a></li>
    </ul>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

  • The topic ‘Getting Sticky posts to work on cutom Query’ is closed to new replies.