We are no longer accepting contributions to Documentation. Please see our post on meta.

WordPress

WP_Query() Loop 2.0

1.0
1.2
1.5
2.0
2.1
2.2
2.3
2.5
2.6
2.7
2.8
2.9
3.0
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
4.0
4.1
4.2
4.3
4.4
4.5
4.6
4.7
4.8
WP_Query to query for posts, pages and custom post types. You will get list for specific posts and pages or custom post types. WP_Query allows you to pull posts from the database according to your criteria.

This draft deletes the entire topic.

Examples

  • 1
    $args = array(
        'post_type'=>'post',
        'posts_per_page' =>'10'
    );
    $latest_posts_query = new WP_Query( $args );
    if($latest_posts_query->have_posts()) :
    while ( $latest_posts_query-> have_posts()) : $latest_posts_query->the_post();
    //Get post details here
    endwhile;
    endif;
    
Please consider making a request to improve this example.

Syntax

Syntax

Parameters

Parameters

Remarks

Remarks

Still have a question about WP_Query() Loop? Ask Question

Topic Outline


    We are no longer accepting contributions to Documentation. Drafts cannot be modified.