How to get all post ID in a certain category? and put the result in a array variable?
$var = array(1,6,11);
where 1, 6, 11 are the postID of specific category.
How to get all post ID in a certain category? and put the result in a array variable?
$var = array(1,6,11);
where 1, 6, 11 are the postID of specific category.
Something like:
<?php
$cat = 47; //category id
$posts=get_posts('showposts=-1&cat='. $cat);
if ($posts) {
foreach($posts as $post) {
echo "<pre>"; print_r($post->ID); echo "</pre>";
}
}
?>thanks MichaelH!
it enlightens me, it really helps!
You must log in to post.