Skip to content

Instantly share code, notes, and snippets.

View onuproy's full-sized avatar
🏠
Working from home

Onup Chandra Barmon onuproy

🏠
Working from home
View GitHub Profile
@onuproy
onuproy / query.php
Created March 6, 2021 20:52 — forked from eliasfaical/query.php
Loop post type WP
<?php
/*
* Loop post type: V1
*/
$posts = array(
array( 'post_type' => 'post1', 'post_per_page' => -1 ),
array( 'post_type' => 'post2', 'post_per_page' => -1 ),
array( 'post_type' => 'post3', 'post_per_page' => -1 )
);
<div class="testimonial">
<?php
$q = new WP_Query(
array('post_type' => array('testimonials'),
'post_status' => array('publish'),
'orderby' => 'date',
'order' => 'ASC',
'posts_per_page' => $sitem,
'service-category' => $category)
);
<?php
$custom_query_args = array (
'post_type' => 'news',
'posts_per_page' => '4'
);
$custom_query_args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$custom_query = new WP_Query( $custom_query_args );