WordPress Query Posts String & Array

Here are a few ways to Query Posts in WordPress as a string and array:-

<?php query_posts('cat=-1&orderby=date&order=DESC&showposts=1'); ?>

Standard ‘Posts’

<?php $latesproducts = new WP_Query('posts_per_page=5&orderby=date&order=desc&post_type=wpsc-product'); ?>
	$latesproducts = new WP_Query( array(
    'post_type' => 'wpsc-product',
    'post_status' => 'publish',
    'orderby' => 'date',
    'posts_per_page' => 5,
    'order' => 'ASC',
    'paged' => get_query_var('paged'),

NB Above we are Querying WP E-Commerce Products as our Custom ‘Post Type’

  'post_parent' => 106,
  'orderby'=> 'menu_order',
  'post_type' => 'page',
  'post_status' => 'publish',
  'posts_per_page' => 100

Query Pages by menu order

About the Author
Wordpress Query Posts String & Array Wordpress Query Posts String &#038; Array 0da77002febbfe28d15144a57bbcc2c9 s 180 d mm r g


A highly experienced Web Designer / Web Developer (Webflow, WordPress, Weebly & Custom), Front-end / Back-end Developer & New Media Specialist, with extensive knowledge of a wide spectrum of technologies in the Development and Creative Industries, built up over a number of years.