Задать вопрос
  • Как упорядочить кастомные посты?

    @Gvynblade Автор вопроса
    Нашел решение
    <?php $queried_object = get_queried_object()->term_id;
     $servers1 = new WP_Query( array ( 'post_type' => 'servers', 'posts_per_page' => 10, 'meta_key' => 'ratings_users', 'orderby' => 'meta_value_num', 'order' => 'DESC', 'tax_query' => array(
    		array(
    			'taxonomy' => 'serverscat',
    			'field'    => 'id',
    			'terms'    => $queried_object
    		)
    	),) ); if ( $servers1->have_posts() ) : ?>
    
    <?php while ( $servers1->have_posts() ) : $servers1->the_post(); ?>
    		
    		<?php
    			/* Include the Post-Format-specific template for the content.
    				* If you want to override this in a child theme, then include a file
    				* called content-___.php (where ___ is the Post Format name) and that will be used instead.
    			*/
    			get_template_part( 'template-parts/content-servers', get_post_format() );
    		?>
    		
    		<?php endwhile; ?>
    Ответ написан
    Комментировать