$value) { $shortcode_attrs .= ' ' . $key . '="' . esc_attr($value) . '"'; } // 2. Xây dựng chuỗi shortcode hoàn chỉnh $shortcode_string = '[' . $shortcode_name . $shortcode_attrs . ']'; // 3. Thực thi shortcode echo do_shortcode($shortcode_string); $return = ob_get_clean(); if (!$return) { wp_send_json_error('Error'); wp_die(); } wp_send_json_success($return); wp_die(); } // show paged add_action('after_adminz_fl_custom_blog_posts', function ($repeater, $atts, $recentPosts) { if (!($atts['adminz_paged_style'] ?? '')) { return; } if (!$recentPosts->have_posts()) { return; } // default pagination echo '
"; print_r($atts['infinitive']); echo ""; return $atts; }); // change query args add_filter('adminz_fl_custom_blog_posts_args', function ($args, $atts) { extract($atts); // ids if (!empty($adminz_ids)) { $adminz_ids = explode(',', $adminz_ids); $adminz_ids = array_map('trim', $adminz_ids); $args = array( 'post__in' => $adminz_ids, 'post_type' => array( 'post', 'featured_item', // Include for its tag archive listing. ), 'numberposts' => -1, 'orderby' => 'post__in', 'posts_per_page' => 9999, 'ignore_sticky_posts' => true, ); // Include for search archive listing. if (is_search()) { $args['post_type'][] = 'page'; } } // post type if (!empty($adminz_post_type)) { $args['post_type'] = explode(',', $adminz_post_type); } // Chuẩn hóa & loại bỏ trùng lặp giữa included và excluded $included_term_ids = !empty($adminz_terms_included) ? array_map('intval', explode(',', $adminz_terms_included)) : []; $excluded_term_ids = !empty($adminz_terms_excluded) ? array_map('intval', explode(',', $adminz_terms_excluded)) : []; // Loại bỏ trùng lặp: term không thể vừa included vừa excluded $included_term_ids = array_diff($included_term_ids, $excluded_term_ids); $excluded_term_ids = array_diff($excluded_term_ids, $included_term_ids); // Khởi tạo tax_query nếu cần if (!isset($args['tax_query'])) { $args['tax_query'] = [ 'relation' => 'AND' ]; } // Xử lý terms included foreach ($included_term_ids as $term_id) { $term = get_term($term_id); if (!is_wp_error($term) && isset($term->taxonomy)) { $args['tax_query'][] = [ 'taxonomy' => $term->taxonomy, 'field' => 'id', 'terms' => $term_id, 'include_children' => true, 'operator' => 'IN', ]; } } // Xử lý terms excluded foreach ($excluded_term_ids as $term_id) { $term = get_term($term_id); if (!is_wp_error($term) && isset($term->taxonomy)) { $args['tax_query'][] = [ 'taxonomy' => $term->taxonomy, 'field' => 'id', 'terms' => $term_id, 'include_children' => true, 'operator' => 'NOT IN', ]; } } // echo "
"; print_r($args); echo ""; // return $args; }, 10, 2);