"wordpress display posts from specific category on page" Code Answer's
You're definitely familiar with the best coding language TypeScript that developers use to develop their projects and they get all their queries like "wordpress display posts from specific category on page" answered properly. Developers are finding an appropriate answer about wordpress display posts from specific category on page related to the TypeScript coding language. By visiting this online portal developers get answers concerning TypeScript codes question like wordpress display posts from specific category on page. Enter your desired code related query in the search bar and get every piece of information about TypeScript code related question on wordpress display posts from specific category on page.
wordpress display posts from specific category on page
The argument isn't category, it is cat. Your query fails because you are using an argument that doesn't exist.
$args = array(
'post_type' => 'post' ,
'orderby' => 'date' ,
'order' => 'DESC' ,
'posts_per_page' => 6,
'cat' => '3',
'paged' => get_query_var('paged'),
'post_parent' => $parent
);
$q = new WP_Query($args);
if ( $q->have_posts() ) {
while ( $q->have_posts() ) {
$q->the_post();
// your loop
}
}
Notice that I have converted your query_posts() into a new WP_Query object. Do not use query_posts(), ever. Even the Codex states so.
Note: This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination). Any modern WP code should use more reliable methods, like making use of pre_get_posts hook, for this purpose.
http://codex.wordpress.org/Function_Reference/query_posts
Also note that I removed unnecessary PHP opening and closing tags and formatted the code for better readability. That alternative control structure syntax is a formula for failure, in my experience.
All those coders who are working on the TypeScript based application and are stuck on wordpress display posts from specific category on page can get a collection of related answers to their query. Programmers need to enter their query on wordpress display posts from specific category on page related to TypeScript code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about wordpress display posts from specific category on page for the programmers working on TypeScript code while coding their module. Coders are also allowed to rectify already present answers of wordpress display posts from specific category on page while working on the TypeScript language code. Developers can add up suggestions if they deem fit any other answer relating to "wordpress display posts from specific category on page". Visit this developer's friendly online web community, CodeProZone, and get your queries like wordpress display posts from specific category on page resolved professionally and stay updated to the latest TypeScript updates.