Hello. There is a question that I can not find a solution. All code cited for understanding the output. The problem is only in the designation of parameters at the very beginning. Complicated by the fact that the function works when the polylang plugin is turned off, which in turn I installed after q-translate, which leaves many tails after deletion, such as broken fields in ACF, but does not display this code when multilanguage is enabled. I do not know how it is connected. I'm trying to fix the problem here and found that 'post_type' => 'solutions' is not recognized, although from the screenshot this type of post exists - http://take.ms/wRhIN . Here you can see that there is a taxonomy of such a post_type, and there are 6 categories in the admin area, each with a certain number of posts. Why it happens? or how to debug such places, tell me, please? (Perhaps, as the output of individual posts or categories through functions or the same var_dump.)
<?php $posts_a = array(); $terms = get_terms("solutions_cat"); if (count($terms)) { foreach ($terms as $term) { $args = array( 'numberposts' => -1, 'post_type' => 'solutions', 'orderby' => 'date', 'order' => 'DESC', 'solutions_cat' => $term->slug ); var_dump($term); $posts = get_posts($args); if ($posts) { foreach ($posts as $post) { $posts_a[$term->name][] = $post; } } } } if ($posts_a): ?> <div class="solutions__prod-wrap"> <? $c_cat = ''; foreach ($posts_a as $cat => $posts): ?> <div class="solutions__prod"> <div class="container"> <div class="row"> <h2 class="solutions__title"><?= $cat ?></h2> </div> <div class="row"> <div class="col"> <div class="solutions__prod-list"> <div class="solutions__prod-slider" uk-slider="center: false"> <div class="uk-position-relative"> <div class="uk-slider-container uk-light"> <ul class="uk-slider-items uk-child-width-1-1 uk-child-width-1-2@s uk-child-width-1-4@l uk-grid-small"> <? foreach ($posts as $post): setup_postdata($post); ?> <li class="solutions__prod-list_order-item"> <a href="<?php the_permalink();?>" class="solutions__prod-list-item tag-tag-<?php $term_list = wp_get_post_terms($post->ID, 'solutions_tags', array("fields" => "ids")); echo implode(' tag-tag-', $term_list); ?>"> <div class="solutions_product-item_image-section"> <?php MultiPostThumbnails::the_post_thumbnail('solutions', 'solutions-mini', NULL, 'solutions-solutions-mini-thumbnail'); ?> </div> <h3 class="solutions_product-item_title"><?php the_title();?></h3> <div class="solutions_product-item_description"> <?php the_excerpt();?> </div> <div class="solutions_product-item_link-section"> <div class="solutions_product-item_link">Learn more ></div> </div> </a> </li> <? endforeach; wp_reset_postdata();?> </ul> </div> <div class="uk-hidden@s uk-light"> <a class="uk-position-center-left uk-position-small" href="#" uk-slidenav-previous uk-slider-item="previous"></a> <a class="uk-position-center-right uk-position-small" href="#" uk-slidenav-next uk-slider-item="next"></a> </div> <div class="uk-visible@s"> <a class="uk-position-center-left-out uk-position-small" href="#" uk-slidenav-previous uk-slider-item="previous"></a> <a class="uk-position-center-right-out uk-position-small" href="#" uk-slidenav-next uk-slider-item="next"></a> </div> </div> <ul class="uk-slider-nav uk-dotnav uk-flex-center uk-margin"></ul> </div> </div> </div> </div> </div> </div> <? endforeach; ?> </div> <?endif;?> var_dump() одного элемента массива из таксономии. в var_dump($term) выводится следующее - object(WP_Term)[7699] public 'term_id' => int 49 public 'name' => string '1. Dealing Desk & Risk Management' (length=37) public 'slug' => string '1-dealing-desk-amp-risk-management' (length=34) public 'term_group' => int 0 public 'term_taxonomy_id' => int 49 public 'taxonomy' => string 'solutions_cat' (length=13) public 'description' => string '' (length=0) public 'parent' => int 0 public 'count' => int 4 public 'filter' => string 'raw' (length=3)