get_posts category
$defaults_param = array(
'numberposts' => -1,
'post_type' => 'post',
'category' => 40 ,
'suppress_filters' => false
);
$get_featured_post = get_posts($defaults_param);
get_posts category
$defaults_param = array(
'numberposts' => -1,
'post_type' => 'post',
'category' => 40 ,
'suppress_filters' => false
);
$get_featured_post = get_posts($defaults_param);
show all posts from category
<?php
$args = array( 'category' => 7, 'post_type' => 'post' );
$postslist = get_posts( $args );
foreach ($postslist as $post) : setup_postdata($post);
?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php the_excerpt(); ?>
<?php endforeach; ?>
Get wordpress posts by category name..!
<?php query_posts('category_name=CATEGORYNAME&showposts=5');
while (have_posts()) : the_post(); ?>
the_title(); // To display the title of all posts that have category name selected
the_content(); // To display the content of all posts that have category name selected
<?php endwhile; ?>
PHP Display Posts by Category in WordPress
$espbc = get_sub_field('add_posts_by_category');
$defaults_param = array(
//'numberposts' => -1,
'post_type' => 'post',
'category' => $espbc,
'posts_per_page' => 6,
'suppress_filters' => false
);
$catPost = get_posts($defaults_param);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us