Forums › Forums › Search & Filter Pro › Modify search.php file to match Archive loop page on site
Tagged: archive loop, search results page
- This topic has 1 reply, 2 voices, and was last updated 6 years, 8 months ago by Trevor.
-
Anonymous(Private) April 23, 2018 at 11:37 am #173744
Hi,
I’ve been trying for many hours using the VC Grid Builder to get the search results page displaying the way the standard Archive page does on the site. If I could get php code in the Grid builder it may work, but have not figured out a way to achieve it.
So I thought, why not modify the search.php page instead to look like the archive page. However after a few unsuccessful attempts I’m wondering if you wouldn’t mind helping by showing me where in the code on the search.php page it should be inserted? Here is the code from the archive loop…
/* === START ARCHIVE LOOP PAGE CONTENT === */
<?phpglobal $mk_options;
$output = ”;
if ($view_params[‘thumbnail_align’] == ‘left’){
$align_class = ‘ content-align-right’;
}else{
$align_class = ‘ content-align-left’;
}$image_height = $view_params[‘grid_image_height’];
$image_width = 400;$post_type = get_post_meta($post->ID, ‘_single_post_type’, true);
$post_type = !empty($post_type) ? $post_type : ‘image’;$attachment_id = mk_get_blog_post_thumbnail($post_type);
$featured_image_src = Mk_Image_Resize::resize_by_id_adaptive($attachment_id, $view_params[‘image_size’], $image_width, $image_height, $crop = true, $dumm = false);
$image_size_atts = Mk_Image_Resize::get_image_dimension_attr($attachment_id, $view_params[‘image_size’], $image_width, $image_height);
$post_width = Mk_Image_Resize::is_default_thumb($featured_image_src[‘default’]) ? ‘full-width-post’ : ”;
$output .= ‘<article id=”‘ . get_the_ID() . ‘” class=”mk-blog-thumbnail-item ‘.$post_type.’-post-type mk-isotop-item ‘ . $post_type . ‘-post-type’.$align_class.’ ‘.$post_width.’ clearfix”>’ . “\n”;
if (!Mk_Image_Resize::is_default_thumb($featured_image_src[‘default’])) {
$output .= ‘<div class=”featured-image” > false)) . ‘”>’;
$output .= ‘ false)) . ‘” title=”‘ . the_title_attribute(array(‘echo’ => false)) . ‘” src=”‘.$featured_image_src[‘dummy’].'” ‘.$featured_image_src[‘data-set’].’ width=”‘.esc_attr($image_size_atts[‘width’]).'” height=”‘.esc_attr($image_size_atts[‘height’]).'” itemprop=”image” />’;
$output .= ‘<div class=”image-hover-overlay”></div>’;$post_type_icon = ‘mk-li-‘ . $post_type;
if ($post_type == ‘blockquote’){ $post_type_icon = ‘mk-icon-quote-left’; }
if ($post_type == ‘twitter’ || $post_type == ‘instagram’) { $post_type_icon = ‘mk-icon-‘ . $post_type; }$output .= ‘<div class=”post-type-badge” href=”‘ . esc_url( get_permalink() ) . ‘”>’.Mk_SVG_Icons::get_svg_icon_by_class_name(false, $post_type_icon).'</div>’;
$output .= ‘</div>’;
}$output .= ‘<div class=”item-wrapper”>’;
// start: [mk-blog-meta]
$output .= ‘<div class=”mk-blog-meta”>’;
if ($view_params[‘disable_meta’] == ‘true’) {
$output.= mk_get_shortcode_view(‘mk_blog’, ‘components/meta’, true);
}
$output.= mk_get_shortcode_view(‘mk_blog’, ‘components/title’, true);
$output.= mk_get_shortcode_view(‘mk_blog’, ‘components/excerpt’, true, [‘excerpt_length’ => $view_params[‘excerpt_length’], ‘full_content’ => false]);$output .= ‘<div class=”mk-teader-button”>’;
$output .= do_shortcode( ‘[mk_button dimension=”outline” corner_style=”pointed” outline_skin=”dark” margin_bottom=”0″ size=”medium” align=”left” url=”‘ . esc_url( get_permalink() ) . ‘”]’.__(‘see artwork’, ‘mk_framework’).'[/mk_button]’ );
$output .= ‘</div>’;$output .= ‘</div>’;
// end: [mk-blog-meta]$output .= ‘</div>’; // end: [item-wrapper]
$output .= ‘<div class=”clearboth”></div></article>’ . “\n\n\n”;
echo $output;
/* === END ARCHIVE LOOP PAGE CONTENT === */Thank you very much.
JamesTrevor(Private) April 23, 2018 at 3:59 pm #173812It depends which version you have of Visual Composer (it has for some time been renamed to Page Builder, but still on CodeCanyon), and NOT the different version that WPBakery now sell on their own direct sales site. Some themes also come with it bundled. Some themes keep their users updated with the latest version, some do not (I think it is 5.4.7). Some themes modify the plugin also.
In general though, this post explains how to use Visual Composer with Search & Filter:
https://support.searchandfilter.com/forums/topic/pagination-not-working-11/#post-105228
-
AuthorPosts