wordpress custom post type Query

  <?php    
  	   $args = array(  
      'post_type' => 'custom_type',
      '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(); 
  ?>

4
2

                                    &lt;?php 
    query_posts(array( 
        'post_type' =&gt; 'portfolio',
        'showposts' =&gt; 10 
    ) );  
?&gt;
&lt;?php while (have_posts()) : the_post(); ?&gt;
        &lt;h2&gt;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;
        &lt;p&gt;&lt;?php echo get_the_excerpt(); ?&gt;&lt;/p&gt;
&lt;?php endwhile;?&gt;

4 (2 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
call custom post type in wordpress query wp database to return custom post type by id create custom post type wordpress code wp_query custom post type id wp_query custom post type category wordpress query of post type how to get custom post type data in wordpress wp get custom post types wp_query get post by post type wordpress post query custom post type get custom post type wp_query show custom post type in wordpress query custom post type wordpress wp get custom post type wordpress post type query wordpress query to get posts of custom posttype wp query for post type get custom post type query wordpress query post type wordpress get custom post type query to get all custom post type posts wordpress wp get custom post type category wordpress query post type custom field value wp query post type wp query get custom post type wordpress php query for custom post type wp_query post type wordpress php custom post type query wp get posts custom post type wp_query get custom post type wp query custom post type wp_query for custom post type wp_query all post for type post type wp query wp query post types all items wordpress get custom post type posts wordpress query on customer post type wordpress php query custom post type custom post type query wordpress wordpress query posts custom post type query get custom post type get custom post type wordpress wp query get post types wordpress query for custom post type wordpress custom post type query wp_query custom post type wordpress query custom post type
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source