Answers for "wordpress custom post loop"

PHP
0

wp loop custom post type

<?php
$loop = new WP_Query(
    array(
        'post_type' => 'yourposttypehere' // This is the name of your post type - change this as required,
        'posts_per_page' => 50 // This is the amount of posts per page you want to show
    )
);
while ( $loop->have_posts() ) : $loop->the_post();
// The content you want to loop goes in here:
?>
 
<div class="col-sm-4">
My column content
</div>
 
<?php endwhile;
wp_reset_postdata();
?>
Posted by: Guest on June-04-2020
0

wordpress post loop

<?php 
if ( have_posts() ) {
	while ( have_posts() ) {
		the_post(); 
		//
		// Post Content here
		//
	} // end while
} // end if
?>
Posted by: Guest on November-05-2020
0

wordpress custom post loop

/**
 * Setup query to show the ‘services’ post type with ‘8’ posts.
 * Output the title with an excerpt.
 */
    $args = array(  
        'post_type' => 'services',
        'post_status' => 'publish',
        'posts_per_page' => 8, 
        'orderby’ => 'title', 
        'order’ => 'ASC', 
    );

    $loop = new WP_Query( $args ); 
        
    while ( $loop->have_posts() ) : $loop->the_post(); 
        print the_title(); 
        the_excerpt(); 
    endwhile;

    wp_reset_postdata();
Posted by: Guest on October-21-2021
0

custom post type query loop wordpress

Custom Post Type Query Loop
Posted by: Guest on December-07-2020

Code answers related to "wordpress custom post loop"

Browse Popular Code Answers by Language