-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage-fanaktie.php
executable file
·149 lines (120 loc) · 4.56 KB
/
page-fanaktie.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<?php
/**
* Template Name: Fanaktier
*/
?>
<?php get_header(); ?>
<script>
var fanshares = {};
fanshares['mikkel-thygesen'] = {
method: 'feed',
link: 'http://www.brondbytrust.dk/shop/mikkel-thygesen/',
picture: 'http://www.brondbytrust.dk/assets/fanaktie-thygesen.jpg',
name: 'Jeg er stolt ejer af en Mikkel Thygesen Fan-aktie',
caption: '',
description: 'Mit køb af denne fan-aktie symboliserer mit bidrag til kampen for at bringe Brøndby IF tilbage til toppen af dansk fodbold.'
};
fanshares['kim-vilfort'] = {
method: 'feed',
link: 'http://www.brondbytrust.dk/shop/kim-vilfort/',
picture: 'http://www.brondbytrust.dk/assets/fanaktie-vilfort.jpg',
name: 'Jeg er stolt ejer af en Kim Vilfort Fan-aktie',
caption: '',
description: 'Mit køb af denne fan-aktie symboliserer mit bidrag til kampen for at bringe Brøndby IF tilbage til toppen af dansk fodbold.'
};
fanshares['per-nielsen'] = {
method: 'feed',
link: 'http://www.brondbytrust.dk/shop/per-nielsen/',
picture: 'http://www.brondbytrust.dk/assets/fanaktie-nielsen.jpg',
name: 'Jeg er stolt ejer af en Per Nielsen Fan-aktie',
caption: '',
description: 'Mit køb af denne fan-aktie symboliserer mit bidrag til kampen for at bringe Brøndby IF tilbage til toppen af dansk fodbold.'
};
fanshares['dan-eggen'] = {
method: 'feed',
link: 'http://www.brondbytrust.dk/shop/dan-eggen/',
picture: 'http://www.brondbytrust.dk/assets/fanaktie-dan-eggen.jpg',
name: 'Jeg er stolt ejer af en Dan Eggen Fan-aktie',
caption: '',
description: 'Mit køb af denne fan-aktie symboliserer mit bidrag til kampen for at bringe Brøndby IF tilbage til toppen af dansk fodbold.'
};
fanshares['ebbe-sand'] = {
method: 'feed',
link: 'http://www.brondbytrust.dk/shop/ebbe-sand/',
picture: 'http://www.brondbytrust.dk/assets/fanaktie-sand.jpg',
name: 'Jeg er stolt ejer af en Ebbe Sand Fan-aktie',
caption: '',
description: 'Mit køb af denne fan-aktie symboliserer mit bidrag til kampen for at bringe Brøndby IF tilbage til toppen af dansk fodbold.'
};
jQuery(function() {
jQuery(".sharetofacebook").click(function(e){
var obj = fanshares[e.currentTarget.id];
if(typeof obj != undefined ){
console.log(obj);
FB.ui(obj, function(response){
if (response && response.post_id) {
jQuery("#event-container").html('<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">×</button> Fan-aktien er delt på din Facebook-væg </div>');
}
});
}
e.preventDefault();
});
});
</script>
<div class="main">
<div class="container">
<div id="event-container">
</div>
<?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="row">
<div class="span12">
<h1 style="text-align: center;">Del dine Fan-aktier på Facebook!</h1>
<div class="product-table">
<?php while ($query->have_posts()) : $query->the_post(); global $product; ?>
<div>
<div>
<div class="productname transparent"><?php the_title() ?></div>
<a href="#" id="<?php echo( basename(get_permalink()) ); ?>" class="sharetofacebook">
<?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_thumbnail_image_width' ).'" height="'.$woocommerce->get_image_size( 'shop_thumbnail_image_height' ).'" />';
} ?>
<div>Del på Facebook</div>
</a>
</div>
</div>
<?php endwhile; ?>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
<?php get_footer(); ?>