Answers for "$wp_query->have_posts()"

PHP
1

wp_query post by category id

$args=array(
    'posts_per_page' => 50, 
    'post_type' => 'my_custom_type'
    'cat' => $cat_id,
);
$wp_query = new WP_Query( $args );
Posted by: Guest on June-20-2021
0

wp query using the_post

<?php 
    query_posts(array( 
        'post_type' => 'portfolio',
        'showposts' => 10 
    ) );  
 while (have_posts()){
 		the_post(); ?>
        <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
        <p><?php echo get_the_excerpt(); ?></p>
<?php } ?>
Posted by: Guest on December-20-2021

Code answers related to "$wp_query->have_posts()"

Browse Popular Code Answers by Language