Getting posts from a know category name

The following example shows how to use the category_name parameter to request post from an know category name.

<?php require('wp-blog-header.php'); ?>
<?php define('WP_USE_THEMES', false);?>
<?php $posts = get_posts('numberposts=10&category_name=news');?>
	<ul class="news-list">
		<?php foreach ($posts as $post) : start_wp(); ?>
			<div class="news-content">
		<?php endforeach;?>

Learn more about query parameter

Leave a Reply




You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

IMPORTANT! To be able to proceed, you need to solve the following simple math (so I know that you are a human) :-)

What is 3 + 6 ?
Please leave these two fields as-is: