Categories

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');?>
<div>
	<ul class="news-list">
		<?php foreach ($posts as $post) : start_wp(); ?>
		<li>
			<div class="news-content">
				<?=$post->post_content?>
			</div>
		</li>
		<?php endforeach;?>
	</ul>
</div>

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 8 + 13 ?
Please leave these two fields as-is: