Answers for "query by post created dat wordpress"

PHP
1

recent post query wordpress

<?php 
            $recent_args = array(
                'post_type' => 'post type name',
                'posts_per_page' => 4,
                'orderby'        => 'date',
                'order'          => 'DESC'
            );      
            $recent_posts = new WP_Query( $recent_args );
            
            if( $recent_posts->have_posts() ) {
        	    while( $recent_posts->have_posts() ) : $recent_posts->the_post(); 
                
                the_title();
                
                endwhile;
            
    		} 
    		else {
    	    	echo "There is no posts";
    	    }
    
    	    wp_reset_postdata();   
 ?>
Posted by: Guest on June-07-2021

Code answers related to "query by post created dat wordpress"

Browse Popular Code Answers by Language