| 1 |
<?php |
| 2 |
global $query,$found_types; |
| 3 |
if( $query->have_posts()): |
| 4 |
?> |
| 5 |
<ul class="tf_search_tab"> |
| 6 |
<li class="active"><a href="#all"><?php _e('All','themify')?></a></li> |
| 7 |
<?php foreach ( array_unique( $found_types ) as $type): ?> |
| 8 |
<?php |
| 9 |
switch ($type){ |
| 10 |
case 'product': |
| 11 |
$title=__('Shop','themify'); |
| 12 |
break; |
| 13 |
case 'post': |
| 14 |
$title=__('Blog','themify'); |
| 15 |
break; |
| 16 |
case 'page': |
| 17 |
$title=__('Page','themify'); |
| 18 |
break; |
| 19 |
default: |
| 20 |
$type_obj = get_post_type_object( $type ); |
| 21 |
$title=$type_obj->labels->singular_name; |
| 22 |
$type_obj=null; |
| 23 |
break; |
| 24 |
} |
| 25 |
?> |
| 26 |
<li><a href="#<?php echo esc_attr( $type ) ?>"><?php echo esc_html( $title ); ?></a></li> |
| 27 |
<?php endforeach; ?> |
| 28 |
</ul> |
| 29 |
<?php $is_disabled = themify_is_image_script_disabled();?> |
| 30 |
<?php while ( $query->have_posts() ):?> |
| 31 |
<?php |
| 32 |
$query->the_post(); |
| 33 |
$post_type = get_post_type(); |
| 34 |
$is_product = $post_type === 'product' && themify_is_woocommerce_active(); |
| 35 |
if(has_post_thumbnail()){ |
| 36 |
$post_image = $is_disabled===false?themify_get_image(array('w'=>47,'h'=>48,'crop'=>true,'urlonly'=>true)):''; |
| 37 |
if(!$post_image){ |
| 38 |
$post_image = $is_product===true?get_the_post_thumbnail_url( null,'shop_thumbnail'):get_the_post_thumbnail_url( null,'thumbnail'); |
| 39 |
} |
| 40 |
} |
| 41 |
else{ |
| 42 |
$post_image = false; |
| 43 |
} |
| 44 |
?> |
| 45 |
<div class="tf_search_item tf_search_<?php echo esc_attr( $post_type ); ?> tf_rel tf_overflow tf_clear"> |
| 46 |
<a href="<?php the_permalink()?>" class="tf_clearfix"> |
| 47 |
<?php if($post_image!==false):?> |
| 48 |
<img src="<?php echo esc_url( $post_image );?>" width="47" height="48" /> |
| 49 |
<?php endif;?> |
| 50 |
<span class="title"><?php echo esc_html( get_the_title() ); ?></span> |
| 51 |
<?php if($is_product===true):?> |
| 52 |
<?php global $product?> |
| 53 |
<span class="price"><?php echo $product->get_price_html()?></span> |
| 54 |
<?php endif;?> |
| 55 |
</a> |
| 56 |
</div> |
| 57 |
<!-- /tf_search_item --> |
| 58 |
<?php endwhile;?> |
| 59 |
|
| 60 |
<?php if($query->max_num_pages>1):?> |
| 61 |
<div class="tf_view_all tf_textc tf_clear"> |
| 62 |
<?php $search_link = get_search_link($_POST['s']);?> |
| 63 |
<?php foreach ($found_types as $type): ?> |
| 64 |
<?php $type_obj = get_post_type_object( $type ); ?> |
| 65 |
<a id="tf_result_link_<?php echo esc_attr( $type ); ?>" href="<?php echo esc_url( add_query_arg(array('type'=>$type),$search_link) ); ?>" class="tf_view_button tf_hide"><?php echo esc_html( __('View All','themify') . ' ' . $type_obj->label ); ?></a> |
| 66 |
<?php endforeach; ?> |
| 67 |
<a id="tf_result_link_item" href="<?php echo esc_url( $search_link )?>" class="tf_view_button tf_hide"><?php _e('View All','themify')?></a> |
| 68 |
</div> |
| 69 |
<!-- /tf_view_all --> |
| 70 |
<?php endif;?> |
| 71 |
<?php else:?> |
| 72 |
<p><?php _e('No Items Found','themify');?></p> |
| 73 |
<?php endif;?> |
| 74 |
|