Showing posts with label Wordpress. Show all posts
Showing posts with label Wordpress. Show all posts

Friday, 10 February 2017

Set pagination codding in wp posts Wordpress

WordPress has the ability to split lists of posts or a single post into multiple pages for "paged" navigation.

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$loop = new WP_Query( array(
'post_type' => 'post_type',
'posts_per_page' => 4,
'orderby'=> 'orderBy_attribute',
'paged'=>$paged
) );


Example:

Wednesday, 8 February 2017

Combined the tax_query and Meta _query of wordpress

WP_Query is a class defined in wp-includes/query.php that deals with the intricacies of a post's (or page's) request to a WordPress blog.

TAX_Query is Creating a taxonomy generally automatically creates a special query variable.which we can use to retrieve posts based on.

Use both the meta_query and the tax_query