Answers for "wordpress get all posts by category"

PHP
1

get_posts category

$defaults_param = array(
				'numberposts'      	=> -1,
				'post_type'        	=> 'post',
				'category' 			=> 40 ,
				'suppress_filters'	=> false
			);
$get_featured_post = get_posts($defaults_param);
Posted by: Guest on January-04-2021
0

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; ?>
Posted by: Guest on January-01-2021
0

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; ?>
Posted by: Guest on May-13-2021
0

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);
Posted by: Guest on July-24-2021

Code answers related to "wordpress get all posts by category"

Browse Popular Code Answers by Language