angyLe
3/27/2016 - 3:35 PM

new_gist_file_0

$args = array(
	'post_type'       => 'gallery',
	'post_status'     => 'publish',
	'posts_per_page'  => 4, // -1
	'order'			  => 'ASC',
	'offset'          => 0,
	'category'        => '',
	'orderby'         => 'post_date',
	'include'         => '',
	'exclude'         => '',
	'meta_key'        => '',
	'meta_value'      => '',
	'post_type'       => 'gallery',
	'post_mime_type'  => '', // image, video, video/mp4
	'post_parent'     => '',
	);
	// sql
	$query = new WP_Query;
	$myposts = $query->query($args);

// что содержит $myposts 

[0] => WP_Post Object
        (
            [ID] => 69
            [post_author] => 1
            [post_date] => 2016-03-27 18:06:38
            [post_date_gmt] => 2016-03-27 15:06:38
            [post_content] => 
            [post_title] => first image
            [post_excerpt] => 
            [post_status] => publish
            [comment_status] => closed
            [ping_status] => closed
            [post_password] => 
            [post_name] => first-image
            [to_ping] => 
            [pinged] => 
            [post_modified] => 2016-03-27 18:06:38
            [post_modified_gmt] => 2016-03-27 15:06:38
            [post_content_filtered] => 
            [post_parent] => 0
            [guid] => http://newsite2.ru/?post_type=gallery&p=69
            [menu_order] => 0
            [post_type] => gallery
            [post_mime_type] => 
            [comment_count] => 0
            [filter] => raw