Answer Posted / Amnish Kumar
"To write a custom query in WordPress, you can use the WP_Query class. Here's an example:nn$args = array('post_type' => 'post', 'posts_per_page' => 5);n$my_query = new WP_Query($args);nwhile ($my_query->have_posts()) : $my_query->the_post(); the_title(); endwhile; wp_reset_postdata();"
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers