-
Notifications
You must be signed in to change notification settings - Fork 8
/
archive-software.php
129 lines (100 loc) · 4.5 KB
/
archive-software.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
<?php
/**
* Shows a list of all available software
*/
// Add a custom post loop
remove_action ( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'bit51_software_loop' );
function bit51_software_loop() {
// Intro Text (from page content)
echo '<div class="page hentry entry">';
echo '<h1 class="entry-title">Software</h1>';
echo '<div class="entry-content">';
echo '<h2 class="software-category">Google Chrome Extensions</h2>';
$args = array(
'post_type' => 'software',
'orderby' => 'title',
'order' => 'ASC',
'posts_per_page' => '12',
'tax_query' => array(
array(
'taxonomy' => 'software_type',
'field' => 'slug',
'terms' => 'google-chrome-extension'
)
)
);
$loop = new WP_Query( $args );
if( $loop->have_posts() ) {
while( $loop->have_posts() ) {
$loop->the_post();
global $post, $bit51_utilities;
$meta = $bit51_utilities->get_plugin_data( $post->ID );
echo '<div class="software-short">';
echo '<h3 class="software-title"><a href="' . get_permalink( $post->ID ) . '">' . get_the_title() . '</a></h3>';
if( $meta != false ) {
echo '<div class="software-rating" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"><span class="rated">Rated:</span> ';
echo '<div class="rating-stars">';
echo '<div class="rating" style="width: ' . ( $meta['Rating'] / 5 ) * 100 . '%;">';
echo '<meta itemprop="ratingValue" content="' . $meta['Rating'] . '">';
echo '<meta itemprop="reviewCount" content="' . $meta['Votes'] . '">';
echo '</div>';
echo '</div>';
echo $meta['Rating'] . '/5 with ' . $meta['Votes'] . ' votes and ' . number_format( substr( $meta['Downloads'], 14 ) ) . ' downloads.';
echo '</div>';
}
echo '<div class="software-excerpt">' . get_the_excerpt() . "</div>";
echo '<div class="software-links">';
echo '<a class="software-info" href="' . get_permalink( $post->ID ) . '" title="' . get_the_title() . ' - More Information" ><i class="icon-info-sign"></i> More Info</a>';
echo '<a class="software-download" href="' . get_post_meta( $post->ID, '_bit51_download_url', true ) . '" title="Download ' . get_the_title() . '" target="_blank" ><i class="icon-cloud-download"></i> Download</a>';
echo '</div>';
echo '</div>';
}
}
echo '<h2 class="software-category">WordPress Plugins</h2>';
$args = array(
'post_type' => 'software',
'orderby' => 'title',
'order' => 'ASC',
'posts_per_page' => '12',
'tax_query' => array(
array(
'taxonomy' => 'software_type',
'field' => 'slug',
'terms' => 'wordpress-plugin'
)
)
);
$loop = new WP_Query( $args );
if( $loop->have_posts() ) {
while( $loop->have_posts() ) {
$loop->the_post();
global $post, $bit51_utilities;
$meta = $bit51_utilities->get_plugin_data( $post->ID );
echo '<div class="software-short">';
echo '<h3 class="software-title"><a href="' . get_permalink( $post->ID ) . '">' . get_the_title() . '</a></h3>';
echo '<div class="software-rating" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"><span class="rated">Rated:</span> ';
echo '<div class="rating-stars">';
echo '<div class="rating" style="width: ' . ( $meta['Rating'] / 5 ) * 100 . '%;">';
echo '<meta itemprop="ratingValue" content="' . $meta['Rating'] . '">';
echo '<meta itemprop="reviewCount" content="' . $meta['Votes'] . '">';
echo '</div>';
echo '</div>';
echo $meta['Rating'] . '/5 with ' . $meta['Votes'] . ' votes and ' . number_format( substr( $meta['Downloads'], 14 ) ) . ' downloads.';
echo '</div>';
echo '<div class="software-excerpt">' . get_the_excerpt() . "</div>";
echo '<div class="software-links">';
echo '<a class="software-info" href="' . get_permalink( $post->ID ) . '" title="' . get_the_title() . ' - More Information" ><i class="icon-info-sign"></i> More Info</a>';
echo '<a class="software-download" href="' . get_post_meta( $post->ID, '_bit51_download_url', true ) . '" title="Download ' . get_the_title() . '" target="_blank" ><i class="icon-cloud-download"></i> Download</a>';
echo '</div>';
echo '</div>';
}
}
//Closing text
echo '</div><!-- end .entry-content -->';
echo '</div><!-- end .page .hentry .entry -->';
}
// Remove standard post info
remove_action( 'genesis_before_post_content', 'genesis_post_info' );
remove_action( 'genesis_after_post_content', 'genesis_post_meta' );
genesis();