-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle.php
executable file
·127 lines (98 loc) · 4.38 KB
/
single.php
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php get_header(); ?>
<div class="main">
<div class="container">
<div class="row">
<div class="span8">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
?>
<div class="post-image">
<?php the_post_thumbnail('post-image'); ?>
</div>
<?php
}
?>
<div class="text-box post">
<span class="byline">Publiceret <?php echo the_time('j. F Y'); ?>, Kl. <?php the_time('H:i'); ?></span>
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<?php the_content(); ?>
<?php the_tags('<p class="tags"><span class="tags-title">Tags:</span> ', ', ', '</p>'); ?>
<?php comments_template(); ?>
</div>
<?php endwhile; else : ?>
<h2><?php _e("Indlægget findes ikke", "brondbytrusttheme"); ?></h2>
<?php endif; ?>
</div>
<div class="span4">
<?php
global $woocommerce;
// Setup product query
$query_args = array(
'post_type' => 'product',
'post_status' => 'publish',
'product_cat' => 'fan-aktier',
'posts_per_page' => 10,
'no_found_rows' => 1,
'meta_key' => '_price',
'orderby' => 'meta_value_num',
'order' => 'asc'
);
$query_args['meta_query'] = array();
if ( ! $instance['show_variations'] ) {
$query_args['meta_query'][] = $woocommerce->query->visibility_meta_query();
$query_args['post_parent'] = 0;
}
$query_args['meta_query'][] = $woocommerce->query->stock_status_meta_query();
$query = new WP_Query( $query_args );
if ( $query->have_posts() ) {
if ( '' !== $title ) {
$title;
} ?>
<div class="product-table sidebar">
<?php while ($query->have_posts()) : $query->the_post(); global $product; ?>
<div>
<div>
<div class="productname"><?php the_title() ?></div>
<a href="<?php the_permalink() ?>">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('shop_fanaktie');
} else {
echo '<img src="'. woocommerce_placeholder_img_src() .'" alt="Placeholder" width="'.$woocommerce->get_image_size( 'shop_fanaktie' ).'" height="'.$woocommerce->get_image_size( 'shop_thumbnail' ).'" />';
} ?>
<div class="pricetag"><?php echo $product->get_price_html() ?></div>
</a>
<?php
switch ( $product->product_type ) {
case "variable" :
$link = apply_filters( 'variable_add_to_cart_url', get_permalink( $product->id ) );
$label = apply_filters( 'variable_add_to_cart_text', __('Select options', 'woocommerce') );
break;
case "grouped" :
$link = apply_filters( 'grouped_add_to_cart_url', get_permalink( $product->id ) );
$label = apply_filters( 'grouped_add_to_cart_text', __('View options', 'woocommerce') );
break;
case "external" :
$link = apply_filters( 'external_add_to_cart_url', get_permalink( $product->id ) );
$label = apply_filters( 'external_add_to_cart_text', __('Read More', 'woocommerce') );
break;
default :
$link = apply_filters( 'add_to_cart_url', esc_url( $product->add_to_cart_url() ) );
$label = apply_filters( 'add_to_cart_text', __('Add to cart', 'woocommerce') );
break;
}
printf('<a href="%s" rel="nofollow" data-product_id="%s" class="btn btn-bstlightblue add_to_cart_button button product_type_%s">%s</a>', $link, $product->id, $product->product_type, $label);
?>
</div>
</div>
<?php endwhile; ?>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>