Building a Custom Query in WordPress

The Parameters in the function or method are used to define that what type of content will be returned in your Loop, it is a custom Loop or altering the primary Loop. While creating Loops it’s necessary to understand what parameters are available for this method to help define what content will be displayed in your post or page. So you can use many different parameters, there is confusing sometimes, parameters in creating your custom Loop to alter the output of your content. Using a set query you can set multiple parameters by separating the parameter name and values with an ampersand.  The detailed list of available parameters are available at the address,  then visit http://codex.wordpress.org/Class_Reference/WP_Query#Parameters.
Below the following sections cover some of the more common used parameters.

Post Parameters

Most obvious, and sometimes most used parameters, select the number of post and types of posts to be displayed in the website:

➤ p=9 — It loads an individual post by the ID.

➤ name=my-slug — It Loads the post based on post slug (permalink tail).

➤ post_status=pending — It Loads posts by post status mean that, if you choose to see only drafts, use post_status=draft.

➤ ignore_sticky_posts — It excludes the sticky posts from being returned first. What is sticky? A sticky post is one that always sorts to the top of the list of posts that are displaying in the website, not depend of the other parameters set for the query. For multiple sticky posts, making them useful for calling attention to news announcements, or highlighting changes, or otherwise grabbing reader’s attention, and this parameter lets permits you to drop them from their priority and slot at the top of the list of posts.

➤ post_type=page — It loads that posts are based on type. If you want to see only pages, and not posts,then post_type=page it will retrieve the pages not post.

➤ posts_per_page=7 — It is use for number of posts  that how many posts to load per page. The default value is to show all the posts, you can set this parameter to –1.

➤ offset=1 — It is use for skip the number of posts before loading.

Pages Parameters

In the pages have parameters it similar to those for posts to control the selection of the pages:

➤ page_id=7 — It use for loads an individual page by the ID. It could be post IDs or user IDs, and page IDs can be found in the dashboard by mouse hover over a page and then look at the URL it is displaying  at the bottom on your browser.

➤ pagename= website Design London — It loads a page by name, in this case the website Design London page.

➤ pagename=parent/child — It loads a child page by slug, or hierarchy of slugs.