Skip to content

Instantly share code, notes, and snippets.

@vladi160
Last active December 2, 2021 00:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vladi160/77f7d0aa46a408a31e85d66d31c18249 to your computer and use it in GitHub Desktop.
Save vladi160/77f7d0aa46a408a31e85d66d31c18249 to your computer and use it in GitHub Desktop.
$args = [
'post_type' => 'post',
'posts_per_page' => 18, 'offset' => 0, 'order' => 'DESC',
'orderby' => 'date', 'post_status' => 'publish',
'category__not_in' => [118, 123, 147 ],
'taxonomy' => ['cardio','meditation','mobility','pbox','pilates','six-pack','strength','stretching','yoga']
];
$query = new WP_Query($args);
var_dump($query->have_posts());
//var_dump($query->posts);
if($query->have_posts()){
foreach($query->posts as $post){
var_dump($post->ID);
var_dump($post->post_title);
var_dump('----------------------------------');
}
}
/**********************Result*********************/
object(WP_Post)#22665 (24) {
["ID"]=>
int(12573)
["post_author"]=>
string(2) "22"
["post_date"]=>
string(19) "2021-12-01 15:10:29"
["post_date_gmt"]=>
string(19) "2021-12-01 13:10:29"
["post_content"]=>
string(0) ""
["post_title"]=>
string(4) "PBox"
["post_excerpt"]=>
string(0) ""
["post_status"]=>
string(7) "publish"
["comment_status"]=>
string(6) "closed"
["ping_status"]=>
string(6) "closed"
["post_password"]=>
string(0) ""
["post_name"]=>
string(7) "pbox-16"
["to_ping"]=>
string(0) ""
["pinged"]=>
string(0) ""
["post_modified"]=>
string(19) "2021-12-02 02:24:19"
["post_modified_gmt"]=>
string(19) "2021-12-02 00:24:19"
["post_content_filtered"]=>
string(0) ""
["post_parent"]=>
int(0)
["guid"]=>
string(29) "https://pulseplus.bg/?p=12573"
["menu_order"]=>
int(0)
["post_type"]=>
string(4) "post"
["post_mime_type"]=>
string(0) ""
["comment_count"]=>
string(1) "0"
["filter"]=>
string(3) "raw"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment