WordPress.org

Support

Support » Themes and Templates » how to call post limited by category

how to call post limited by category

  • hi, i m calling my post by category name : the given code is working well but i need to do that i want to make limit of post, i want to show only on latest post! can any one tell me how should my arrange while loop or by for loop??

    <?php
    
    //The Query
    $query = new WP_Query( 'category_name=Business-News' );
    echo '<ul>';
     //The Loop
    while ( $query->have_posts() ) : $query->the_post();
    	echo '<li>';
    	$queried_post = get_post($cat_id);
    	echo $queried_post->post_thumbnail;
    	echo $queried_post->post_content;
    	echo '</li>
    ';
    endwhile;
    echo '</ul>';
    	?>

    [please mark any posted code – http://codex.wordpress.org/Forum_Welcome#Posting_Code ]

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how to call post limited by category’ is closed to new replies.
Skip to toolbar