pobranie listy wpisów custom post

Wykaz wszystkich wpisów konkretnego Custom Post


      <?php $args = array( 'post_type' => 'custom_post_name',
        'posts_per_page'	=> -1,
        'orderby'		=> 'post_date',
        'order'			=> 'DESC'
      );
      $wp_query = new WP_Query( $args );
      while( $wp_query->have_posts() ){
        $wp_query->the_post(); ?>
          <a href="<?php the_permalink();?>" title="<?php the_title(); ?>"><?php the_title(); ?></a>
      <?php } ?>
      <?php wp_reset_query(); ?>


pobranie na stronę home wykazu z paru custom postów:

function get_homepost() {
	$args = array(
		'post_type'     => array('edition', 'event'),
		'posts_per_page'    => -1,
		'orderby'	=> 'date',
		'order'		=> 'ASC'
	);
	// The Query
	$query = new WP_Query( $args );

	return $query;
}

sortowanie po dacie custom field:


<?php $args = array( 'post_type' => 'testimonials',
  'posts_per_page'    => -1,
	'meta_key'   => 'testimonial-when',
	'orderby'    => 'meta_value_num',
	'order'      => 'DESC',
);
$wp_query = new WP_Query( $args );
while( $wp_query->have_posts() ){
  $wp_query->the_post(); ?>
  <div class="testimonial-item">
    <div class="testimonial-item-content">
      <h6><?php the_title(); ?></h6>
      <?php the_content(); ?>
    </div>
    <span class="author"><img src="<?php bloginfo('template_url');?>/images/icon-user.png" alt="testimonial Building vision London" />
      <?php $date = get_field('testimonial-when', false, false);
      $date = new DateTime($date); ?>
      <?php the_field('testimonial-who');?>  |  <?php echo $date->format('j M Y'); ?>
    </span>
  </div>
<?php } ?>
<?php wp_reset_query(); ?>