У всех типов сообщений есть настраиваемое поле для даты, и их нужно сортировать с датой поля. На данный момент я не могу получить, как заказать их, я попробовал способ, который упоминается ниже, но я не добился успеха, и один из них должен получить фильтр с опубликованной датой. Также мне нужно отобразить дату из настраиваемого поля вместо опубликованной даты.
<?php $orderby=> array( 'news-release' => wpcf-news-date, 'bulletins' => wpcf-bulletins-date, 'proposed-regulation' => the_date(), 'notice' => wpcf-notice-date, ); $post_args = array( 'post_type' => array( 'news-release', 'proposed-regulation', 'bulletin', 'notice '), 'posts_per_page' => 10, 'post_status' => 'publish', 'orderby' => $orderby, order => 'DESC' 'tax_query' => array( array( 'taxonomy' => 'latest-post', 'field' => 'slug', 'terms' => array('latest-posts' => 'show') ), ) ); $not_query = new WP_Query( $not_args ); // The Loop if ( $not_query->have_posts() ) : while ( $not_query->have_posts() ) : $not_query->the_post(); ?> <article> <div class="latest-row"> <div class="date-block"> <?php echo $orderby ?> </div> <div class="latest-title"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php echo get_post_title($post, false); ?> <?php echo sprintf( __( ' - %s' ), types_render_field('notice-title') ); ?></a> </div> </div> </article> <?php endwhile; ?> <?php else : ?> <p><strong><?php echo( 'There is currently no content available.'); ?></strong></p> <?php endif; /* Restore original Post Data */ wp_reset_postdata(); ?>