1 | <?php |
---|
2 | $is_commercial = has_term( 'commercial', 'theme_business_model', $theme ); |
---|
3 | $external_support_url = $is_commercial ? get_post_meta( $theme->ID, 'external_support_url', true ) : ''; |
---|
4 | $is_community = has_term( 'community', 'theme_business_model', $theme ); |
---|
5 | $external_repository_url = $is_community ? get_post_meta( $theme->ID, 'external_repository_url', true ) : ''; |
---|
6 | $can_configure_categorization_options = current_user_can( 'theme_configure_categorization_options', $theme ); |
---|
7 | ?> |
---|
8 | <div> |
---|
9 | <div class="theme-navigation"> |
---|
10 | <a class="close" href="<?php echo home_url('/'); ?>"><?php _e( 'Return to Themes List', 'wporg-themes' ); ?></a> |
---|
11 | <div class="navigation post-navigation"> |
---|
12 | <button class="left dashicons dashicons-arrow-left-alt2 disabled"><span class="screen-reader-text"><?php _e( 'Show previous theme', 'wporg-themes' ); ?></span></button> |
---|
13 | <button class="right dashicons dashicons-arrow-right-alt2 disabled"><span class="screen-reader-text"><?php _e( 'Show next theme', 'wporg-themes' ); ?></span></button> |
---|
14 | </div> |
---|
15 | </div> |
---|
16 | <div class="theme-wrap"> |
---|
17 | <?php printf( '<div class="theme-about hentry" data-slug="%s">' . "\n", $theme->slug ); ?> |
---|
18 | <?php if ( time() - strtotime( $theme->last_updated ) > 2 * YEAR_IN_SECONDS ) { ?> |
---|
19 | <div class="theme-notice notice notice-warning notice-alt"> |
---|
20 | <p><?php _e( 'This theme <strong>hasn’t been updated in over 2 years</strong>. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.', 'wporg-themes' ); ?></p> |
---|
21 | </div><!-- .theme-notice --> |
---|
22 | <?php } ?> |
---|
23 | |
---|
24 | <div> |
---|
25 | <h1 class="theme-name entry-title"><?php echo esc_html( $theme->name ); ?></h1> |
---|
26 | <?php if ( $theme->author->display_name ) { ?> |
---|
27 | <span class="theme-author"><?php printf( _x( 'By %s', 'theme author', 'wporg-themes' ), '<a href="https://wordpress.org/themes/author/' . $theme->author->user_nicename . '/"><span class="author">' . esc_html( $theme->author->display_name ) . '</span></a>' ); ?></span> |
---|
28 | <?php } ?> |
---|
29 | |
---|
30 | <?php if ( is_user_logged_in() && wporg_themes_is_favourited( $theme->slug ) ) { ?> |
---|
31 | <span class="dashicons dashicons-heart favorite favorited"></span> |
---|
32 | <?php } elseif ( is_user_logged_in() ) { ?> |
---|
33 | <span class="dashicons dashicons-heart favorite"></span> |
---|
34 | <?php } ?> |
---|
35 | </div> |
---|
36 | |
---|
37 | <div class="theme-head"> |
---|
38 | <?php if ( $is_community ) : ?> |
---|
39 | <div class="widget categorization-widget categorization-widget-community"> |
---|
40 | <h3><?php esc_html_e( 'Community Theme', 'wporg-themes' ); ?></h3> |
---|
41 | <?php |
---|
42 | if ( $external_repository_url ) : ?> |
---|
43 | <a href="<?php echo esc_url( $external_repository_url ); ?>" rel="nofollow"><?php _e( 'Contribute', 'wporg-themes' ); ?></a> |
---|
44 | <?php endif; ?> |
---|
45 | <p><?php esc_html_e( 'This theme is developed and supported by a community.', 'wporg-themes' ); ?></p> |
---|
46 | </div> |
---|
47 | <?php endif; ?> |
---|
48 | |
---|
49 | <?php if ( $is_commercial ) : ?> |
---|
50 | <div class="widget categorization-widget categorization-widget-commercial"> |
---|
51 | <h3><?php esc_html_e( 'Commercial Theme', 'wporg-themes' ); ?></h3> |
---|
52 | <?php |
---|
53 | if ( $external_support_url ) : ?> |
---|
54 | <a href="<?php echo esc_url( $external_support_url ); ?>" rel="nofollow"><?php _e( 'Support', 'wporg-themes' ); ?></a> |
---|
55 | <?php endif; ?> |
---|
56 | <p><?php esc_html_e( 'This theme is free but offers additional paid commercial upgrades or support.', 'wporg-themes' ); ?></p> |
---|
57 | </div> |
---|
58 | <?php endif; ?> |
---|
59 | |
---|
60 | <div class="theme-actions clear"> |
---|
61 | <a href="<?php echo esc_url( $theme->preview_url ); ?>" class="button button-secondary alignleft"><?php _e( 'Preview', 'wporg-themes' ); ?></a> |
---|
62 | <a href="<?php echo esc_url( $theme->download_link); ?>" class="button button-primary alignright"><?php _e( 'Download', 'wporg-themes' ); ?></a> |
---|
63 | </div> |
---|
64 | |
---|
65 | <?php if ( !empty( $theme->parent ) ) { ?> |
---|
66 | <div class="theme-notice notice notice-info notice-alt"> |
---|
67 | <p class="parent"><?php printf( __( 'This is a child theme of %s.', 'wporg-themes' ), sprintf( '<a href="%1$s">%2$s</a>', home_url( $theme->parent['slug'] . '/' ), esc_html( $theme->parent['name'] ) ) ); ?></p> |
---|
68 | </div> |
---|
69 | <?php } ?> |
---|
70 | |
---|
71 | <div class="theme-meta-info"> |
---|
72 | <p class="version"> |
---|
73 | <?php printf( __( 'Version: %s', 'wporg-themes' ), '<strong>' . esc_html( $theme->version ) . '</strong>' ); ?> |
---|
74 | </p> |
---|
75 | <p class="updated"> |
---|
76 | <?php printf( __( 'Last updated: %s', 'wporg-themes' ), |
---|
77 | /* translators: localized date format, see http://php.net/date */ |
---|
78 | '<strong>' . date_i18n( _x( 'F j, Y', 'last update date format', 'wporg-themes' ), strtotime( $theme->last_updated ) ) . '</strong>' |
---|
79 | ); ?> |
---|
80 | </p> |
---|
81 | <?php |
---|
82 | $active_installs = $theme->active_installs; |
---|
83 | if ( $active_installs < 10 ) { |
---|
84 | $active_installs = __( 'Less than 10', 'wporg-themes' ); |
---|
85 | } elseif ( $active_installs >= 1000000 ) { |
---|
86 | $active_installs = __( '1+ million', 'wporg-themes' ); |
---|
87 | } else { |
---|
88 | $active_installs = number_format_i18n( $active_installs ) . '+'; |
---|
89 | } |
---|
90 | ?> |
---|
91 | <p class="active_installs"><?php printf( __( 'Active Installations: %s', 'wporg-themes' ), '<strong>' . $active_installs . '</strong>' ); ?></p> |
---|
92 | <?php if ( ! empty( $theme->requires ) ) { ?> |
---|
93 | <p class="requires"> |
---|
94 | <?php printf( __( 'WordPress Version: %s', 'wporg-themes' ), '<strong>' . sprintf( __( '%s or higher', 'wporg-themes' ), esc_html( $theme->requires ) ) . '</strong>' ); ?> |
---|
95 | </p> |
---|
96 | <?php } ?> |
---|
97 | <?php if ( ! empty( $theme->requires_php ) ) { ?> |
---|
98 | <p class="requires_php"> |
---|
99 | <?php printf( __( 'PHP Version: %s', 'wporg-themes' ), '<strong>' . sprintf( __( '%s or higher', 'wporg-themes' ), esc_html( $theme->requires_php ) ) . '</strong>' ); ?> |
---|
100 | </p> |
---|
101 | <?php } ?> |
---|
102 | <?php if ( $theme->theme_url ) { ?> |
---|
103 | <p class="theme_homapge"><a href="<?php echo esc_url( $theme->theme_url ); ?>"><?php _e( 'Theme Homepage', 'wporg-themes' ); ?></a></p> |
---|
104 | <?php } ?> |
---|
105 | </div> |
---|
106 | </div><!-- .theme-head --> |
---|
107 | |
---|
108 | <div class="theme-info"> |
---|
109 | <?php if ( $theme->screenshot_url ) { ?> |
---|
110 | <?php $escaped_screenshot_url = esc_url( $theme->screenshot_url ); ?> |
---|
111 | <div class="screenshot"> |
---|
112 | <picture> |
---|
113 | <source media="(min-width: 782px)" srcset="<?php echo $escaped_screenshot_url; ?>?w=572&strip=all, <?php echo $escaped_screenshot_url; ?>?w=1144&strip=all 2x"> |
---|
114 | <source media="(min-width: 481px) and (max-width: 782px)" srcset="<?php echo $escaped_screenshot_url; ?>?w=700&strip=all, <?php echo $escaped_screenshot_url; ?>?w=1400&strip=all 2x"> |
---|
115 | <source media="(min-width: 401px) and (max-width: 480px)" srcset="<?php echo $escaped_screenshot_url; ?>?w=420&strip=all, <?php echo $escaped_screenshot_url; ?>?w=840&strip=all 2x"> |
---|
116 | <source media="(max-width: 400px)" srcset="<?php echo $escaped_screenshot_url; ?>?w=344&strip=all, <?php echo $escaped_screenshot_url; ?>?w=688&strip=all 2x"> |
---|
117 | <img src="<?php echo $escaped_screenshot_url; ?>?w=572&strip=all" srcset="<?php echo $escaped_screenshot_url; ?>?w=1144&strip=all 2x" loading="lazy" alt=""> |
---|
118 | </picture> |
---|
119 | </div> |
---|
120 | <?php } else { ?> |
---|
121 | <div class="screenshot blank"></div> |
---|
122 | <?php } ?> |
---|
123 | |
---|
124 | <div class="theme-description entry-summary"><p><?php echo esc_html( $theme->description ); ?></p></div> |
---|
125 | |
---|
126 | <?php if ( $theme->tags ) { ?> |
---|
127 | <div class="theme-tags"> |
---|
128 | <h2><?php _e( 'Tags:', 'wporg-themes' ); ?></h2> |
---|
129 | <?php |
---|
130 | $tag_links = array(); |
---|
131 | foreach ( $theme->tags as $slug => $tagname ) { |
---|
132 | $tag_links[] = sprintf( |
---|
133 | "<a href='%s'>%s</a>", |
---|
134 | esc_url( home_url( "/tags/$slug/" ) ), |
---|
135 | esc_html( translate( $tagname, 'wporg-themes' ) ) |
---|
136 | ); |
---|
137 | } |
---|
138 | echo implode( ', ', $tag_links ); |
---|
139 | ?> |
---|
140 | </div><!-- .theme-tags --> |
---|
141 | <?php } ?> |
---|
142 | |
---|
143 | <div class="theme-downloads"> |
---|
144 | </div><!-- .theme-downloads --> |
---|
145 | |
---|
146 | <?php if ( $can_configure_categorization_options && $is_community ) : ?> |
---|
147 | <?php $field_name = 'external_repository_url'; ?> |
---|
148 | <div class="theme-categorization-options"> |
---|
149 | <h3><?php esc_html_e( 'Community Options', 'wporg-themes' ); ?></h2> |
---|
150 | |
---|
151 | <p><?php esc_html_e('This theme is developed and supported by a community.', 'wporg-themes' ); ?></p> |
---|
152 | |
---|
153 | <form id="community" class="categorization" method="POST"> |
---|
154 | <p> |
---|
155 | <?php printf( '<label for="%s">%s</label>', esc_attr( $field_name ), esc_attr__( 'Development repository URL', 'wporg-themes' ) ); ?> |
---|
156 | <?php printf( |
---|
157 | '<input id="%s" type="text" name="%s" value="%s" data-original-value="%s">', |
---|
158 | esc_attr( $field_name ), |
---|
159 | esc_attr( $field_name ), |
---|
160 | esc_url( $external_repository_url ), |
---|
161 | esc_url( $external_repository_url ) |
---|
162 | ); ?> |
---|
163 | <span class="help"><?php esc_attr_e( 'Optional. The URL where development happens, such as at github.com.', 'wporg-themes' ); ?></span> |
---|
164 | </p><p> |
---|
165 | <button class="button button-secondary" type="submit"><?php esc_attr_e( 'Save', 'wporg-themes' ); ?></button> |
---|
166 | <span class="success-msg"><?php esc_html_e( 'Saved!', 'wporg-themes' ); ?></span> |
---|
167 | </p> |
---|
168 | </form> |
---|
169 | </div> |
---|
170 | <?php endif; ?> |
---|
171 | |
---|
172 | <?php if ( $can_configure_categorization_options && $is_commercial ) : ?> |
---|
173 | <?php $field_name = 'external_support_url'; ?> |
---|
174 | <div class="theme-categorization-options"> |
---|
175 | <h3><?php esc_html_e( 'Commercial Options', 'wporg-themes' ); ?></h2> |
---|
176 | |
---|
177 | <p><?php esc_html_e('This theme is free but offers paid upgrades, support, and/or add-ons.', 'wporg-themes' ); ?></p> |
---|
178 | |
---|
179 | <form id="commercial" class="categorization" method="POST"> |
---|
180 | <p> |
---|
181 | <?php printf( '<label for="%s">%s</label>', esc_attr( $field_name ), esc_attr__( 'Commercial support URL', 'wporg-themes' ) ); ?> |
---|
182 | <?php printf( |
---|
183 | '<input id="%s" type="text" name="%s" value="%s" data-original-value="%s">', |
---|
184 | esc_attr( $field_name ), |
---|
185 | esc_attr( $field_name ), |
---|
186 | esc_url( $external_support_url ), |
---|
187 | esc_url( $external_support_url ) |
---|
188 | ); ?> |
---|
189 | <span class="help"><?php esc_attr_e( 'Optional. The URL for theme support, other than its support forum on wordpress.org.', 'wporg-themes' ); ?></span> |
---|
190 | </p><p> |
---|
191 | <button class="button button-secondary" type="submit"><?php esc_attr_e( 'Save', 'wporg-themes' ); ?></button> |
---|
192 | <span class="success-msg"><?php esc_html_e( 'Saved!', 'wporg-themes' ); ?></span> |
---|
193 | </p> |
---|
194 | </form> |
---|
195 | </div> |
---|
196 | <?php endif; ?> |
---|
197 | </div> |
---|
198 | |
---|
199 | <div class="theme-meta"> |
---|
200 | <div class="theme-ratings"> |
---|
201 | <h2><?php _e( 'Ratings', 'wporg-themes' ); ?></h2> |
---|
202 | |
---|
203 | <a class="reviews-link" href="//wordpress.org/support/theme/<?php echo $theme->slug; ?>/reviews/"><?php esc_html_e( 'See all', 'wporg-themes' ); ?></a> |
---|
204 | |
---|
205 | <?php if ( $theme->rating ) { ?> |
---|
206 | <div class="rating rating-<?php echo round( $theme->rating / 10 ) * 10; ?>"> |
---|
207 | <span class="one"></span> |
---|
208 | <span class="two"></span> |
---|
209 | <span class="three"></span> |
---|
210 | <span class="four"></span> |
---|
211 | <span class="five"></span> |
---|
212 | <p class="description"><?php printf( __( '%s out of 5 stars.', 'wporg-themes' ), '<span>' . round( $theme->rating / 20 / 0.5 )*0.5 . '</span>' ); ?></p> |
---|
213 | </div> |
---|
214 | <?php } else { ?> |
---|
215 | <div class="rating"> |
---|
216 | <div class="ratings"><?php _e( 'This theme has not been rated yet.', 'wporg-themes' ); ?></div> |
---|
217 | </div> |
---|
218 | <?php } ?> |
---|
219 | |
---|
220 | <?php if ( $theme->ratings ) { ?> |
---|
221 | <ul> |
---|
222 | <?php foreach ( range( 5, 1 ) as $stars ) : |
---|
223 | $rating_bar_width = $theme->num_ratings ? 100 * $theme->ratings[$stars] / $theme->num_ratings : 0; |
---|
224 | ?> |
---|
225 | <li class="counter-container"> |
---|
226 | <a href="//wordpress.org/support/theme/<?php echo $theme->slug; ?>/reviews/?filter=<?php echo $stars; ?>" title="<?php echo esc_attr( sprintf( _n( 'Click to see reviews that provided a rating of %d star', 'Click to see reviews that provided a rating of %d stars', $stars, 'wporg-themes' ), $stars ) ); ?>"> |
---|
227 | <span class="counter-label"><?php printf( _n( '%d star', '%d stars', $stars, 'wporg-themes' ), $stars ); ?></span> |
---|
228 | <span class="counter-back"> |
---|
229 | <span class="counter-bar" style="width: <?php echo $rating_bar_width; ?>%;"></span> |
---|
230 | </span> |
---|
231 | <span class="counter-count"><?php echo $theme->ratings[$stars]; ?></span> |
---|
232 | </a> |
---|
233 | </li> |
---|
234 | <?php endforeach; ?> |
---|
235 | </ul> |
---|
236 | <?php } ?> |
---|
237 | |
---|
238 | <a class="button button-secondary" href="https://wordpress.org/support/theme/<?php echo $theme->slug; ?>/reviews/#new-post"><?php _e( 'Add my review', 'wporg-themes' ); ?></a> |
---|
239 | </div><!-- .theme-rating --> |
---|
240 | |
---|
241 | <div class="theme-support"> |
---|
242 | <h2><?php _e( 'Support', 'wporg-themes' ); ?></h2> |
---|
243 | <p><?php _e( 'Got something to say? Need help?', 'wporg-themes' ); ?></p> |
---|
244 | <a href="//wordpress.org/support/theme/<?php echo $theme->slug; ?>" class="button button-secondary"><?php _e( 'View support forum', 'wporg-themes' ); ?></a> |
---|
245 | </div><!-- .theme-support --> |
---|
246 | |
---|
247 | <div class="theme-report"> |
---|
248 | <h2><?php _e( 'Report', 'wporg-themes' ); ?></h2> |
---|
249 | <p><?php _e( 'Does this theme have major issues?', 'wporg-themes' ); ?></p> |
---|
250 | <?php |
---|
251 | $report_url = add_query_arg( |
---|
252 | urlencode_deep( array_filter( array( |
---|
253 | 'rep-theme' => "https://wordpress.org/themes/{$theme->slug}/", |
---|
254 | 'rep-subject' => "Reported Theme: {$theme->name}", // Not translated, email subject. |
---|
255 | 'rep-name' => wp_get_current_user()->user_login, |
---|
256 | ) ) ), |
---|
257 | 'https://make.wordpress.org/themes/report-theme/' |
---|
258 | ); |
---|
259 | ?> |
---|
260 | <a rel="nofollow" href="<?php echo esc_url( $report_url ); ?>" class="button button-secondary"><?php _e( 'Report this theme', 'wporg-themes' ); ?></a> |
---|
261 | </div><!-- .theme-report --> |
---|
262 | |
---|
263 | <div class="theme-translations"> |
---|
264 | <h2><?php _e( 'Translations', 'wporg-themes' ); ?></h2> |
---|
265 | <p> |
---|
266 | <a href="<?php echo esc_url( "https://translate.wordpress.org/projects/wp-themes/{$theme->slug}" ); ?>"> |
---|
267 | <?php printf( __( 'Translate %s', 'wporg-themes' ), $theme->name ); ?> |
---|
268 | </a> |
---|
269 | </p> |
---|
270 | </div><!-- .theme-translations --> |
---|
271 | |
---|
272 | <div class="theme-devs"> |
---|
273 | <h2><?php _e( 'Subscribe', 'wporg-themes' ); ?></h2> |
---|
274 | <ul class="unmarked-list"> |
---|
275 | <li> |
---|
276 | <a href="//themes.trac.wordpress.org/log/<?php echo $theme->slug; ?>?limit=100&mode=stop_on_copy&format=rss"> |
---|
277 | <span class="dashicons dashicons-rss"></span><?php _e( 'Development Log', 'wporg-themes' ); ?> |
---|
278 | </a> |
---|
279 | </li> |
---|
280 | </ul> |
---|
281 | |
---|
282 | <h2><?php _e( 'Browse the Code', 'wporg-themes' ); ?></h2> |
---|
283 | <ul class="unmarked-list"> |
---|
284 | <li><a href="//themes.trac.wordpress.org/log/<?php echo $theme->slug; ?>/" rel="nofollow"><?php _e( 'Development Log', 'wporg-themes' ); ?></a></li> |
---|
285 | <li><a href="//themes.svn.wordpress.org/<?php echo $theme->slug; ?>/" rel="nofollow"><?php _e( 'Subversion Repository', 'wporg-themes' ); ?></a></li> |
---|
286 | <li><a href="//themes.trac.wordpress.org/browser/<?php echo $theme->slug; ?>/" rel="nofollow"><?php _e( 'Browse in Trac', 'wporg-themes' ); ?></a></li> |
---|
287 | <li><a href="//themes.trac.wordpress.org/query?keywords=~theme-<?php echo $theme->slug; ?>" rel="nofollow"><?php _e( 'Trac Tickets', 'wporg-themes' ); ?></a></li> |
---|
288 | </ul> |
---|
289 | </div><!-- .theme-devs --> |
---|
290 | </div> |
---|
291 | </div> |
---|
292 | </div> |
---|
293 | </div> |
---|