/** * return search result HTML * @since: 2.0 */ public function output_search_result($search, $skin_id = 0) { $skin_id = intval($skin_id); if ($search == '' || $skin_id === 0) { return __('Not found', EG_TEXTDOMAIN); } $post_types = get_post_types(array('public' => true, 'exclude_from_search' => false), 'objects'); $searchable_types = array(); if ($post_types) { foreach ($post_types as $type) { $searchable_types[] = $type->name; } } $args = array('s' => $search, 'showposts' => -1, 'post_type' => $searchable_types); $args = apply_filters('essgrid_modify_search_query', $args); $query_type = get_option('tp_eg_query_type', 'wp_query'); $tp_allsearch = new WP_Query($args); if (!$tp_allsearch->post_count) { return __('Not found', EG_TEXTDOMAIN); } global $post; $posts = array(); if ($tp_allsearch->have_posts()) { while ($tp_allsearch->have_posts()) { $tp_allsearch->the_post(); $posts[] = $post->ID; } } $alias = Essential_Grid::get_alias_by_id($skin_id); if ($alias == '') { return __('Not found', EG_TEXTDOMAIN); } $content = do_shortcode('[ess_grid alias="' . $alias . '" posts="' . implode(',', $posts) . '"]'); wp_reset_query(); return $content; }
<?php if (!defined('ABSPATH')) { die('No direct access allowed'); } wp_enqueue_style('my_essentials', get_template_directory_uri() . '/mdf_templates/any/my_essentials/css/styles.css'); global $mdf_loop; MDTF_SORT_PANEL::mdtf_catalog_ordering(); if (class_exists('Essential_Grid')) { $_REQUEST['mdf_is_essential'] = true; global $essential; $ess_grid_handle = Essential_Grid::get_alias_by_id($essential); echo do_shortcode('[ess_grid alias="' . $ess_grid_handle . '"][/ess_grid]'); }