forked from hannannexus/plakater
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
73 lines (45 loc) · 2.06 KB
/
Copy pathsearch.php
File metadata and controls
73 lines (45 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* Template Name: Search Page
*/
?>
<?php get_header(); ?>
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php if ( have_posts() ) : ?>
<header class="page-header">
<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'shape' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
</header><!-- .page-header -->
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<a href="<?php the_permalink() ?>">
<h2><?php the_title(); ?></h2>
</a>
<p><?php the_post_thumbnail( 'medium' ); ?></p>
<?php
global $post;
$product = wc_get_product( $post->ID );
//print_r($terms);
// $product->get_regular_price();
// $product->get_sale_price();
// $product->get_price();
//category
$terms = get_the_terms($post->ID, 'product_cat');
?>
<p>Price:<?php echo $product->get_price(); ?></p>
<?php
foreach ($terms as $term) {
$product_cat = $term->name;
?>
<p>Category: <?php echo $product_cat;?></p>
<?php
break;
}
?>
<?php endwhile; ?>
<?php else : ?>
<?php echo "No result found"; ?>
<?php endif; ?>
</div><!-- #content .site-content -->
</section><!-- #primary .content-area -->
<?php get_footer(); ?>