function uncode_index_get_query() { $loop = vc_post_param('content'); $allItems = vc_post_param('allItems'); $template_single = vc_post_param('templateSingle'); $template_post = vc_post_param('templatePost'); $template_portfolio = vc_post_param('templatePortfolio'); $template_page = vc_post_param('templatePage'); $template_product = vc_post_param('templateProduct'); $exclude_current = vc_post_param('postid'); if (empty($loop)) { return; } require_once vc_path_dir('PARAMS_DIR', 'loop/loop.php'); add_filter('pre_get_posts', 'uncode_hide_posts_not_published'); if ($allItems === 'true') { add_filter('pre_get_posts', 'uncode_all_posts'); } global $uncode_index_map; $u_index = new uncode_index($uncode_index_map); list($args, $my_query) = $u_index->vc_build_loop_query($loop, get_the_ID()); if (vc_post_param('custom_order') === 'true') { if (vc_post_param('order_ids') !== '') { $ordered = array(); $post_list = explode(',', vc_post_param('order_ids')); foreach ($post_list as $key) { foreach ($my_query->posts as $skey => $spost) { if ($key == $spost->ID) { $ordered[] = $spost; unset($my_query->posts[$skey]); } } } $my_query->posts = array_merge($my_query->posts, $ordered); } } $html = ''; while ($my_query->have_posts()) { $my_query->the_post(); // Get post from query $post = new stdClass(); // Creating post object. $post->id = get_the_ID(); $post->link = get_permalink($post->id); $post->type = get_post_type($post->id); $template_cat = ''; switch ($post->type) { case 'post': $template_cat = $template_post; break; case 'portfolio': $template_cat = $template_portfolio; break; case 'page': $template_cat = $template_page; break; case 'product': $template_cat = $template_product; break; } $html .= '<li class="list-list-item" data-id="' . $post->id . '"> <div class="option-tree-setting"> <div class="open"><span class="post-title">' . get_the_title() . '</span> <span class="grey">' . $post->type . '</span><span class="grey size">width: <span class="single_width_factor"></span>, height: <span class="single_height_factor"></span></span></div> <div class="button-section"> <a href="javascript:void(0);" class="option-tree-setting-edit option-tree-ui-button button left-item" title="Edit"> <span class="icon fa fa-pencil3"></span>Edit </a> <a href="javascript:void(0);" class="option-tree-setting-reset option-tree-ui-button button left-item hidden" title="Reset"> <span class="icon fa fa-reload"></span> </a> </div> <div class="option-tree-setting-body">' . $template_single . $template_cat . '</div> </div> </li>'; } $html = str_replace('\\"', '"', $html); echo do_shortcode(shortcode_unautop($html)); die; }