Changeset 1404409
- Timestamp:
- 04/26/2016 09:58:05 AM (10 years ago)
- Location:
- sf-category-menu/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (5 diffs)
-
sf-category-menu.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sf-category-menu/trunk/readme.txt
r1335051 r1404409 1 1 === SF Category Menu === 2 2 Contributors: Studiofreya 3 Donate link: https://studiofreya.com/ wordpress/wordpress-plugins/sf-category-menu/3 Donate link: https://studiofreya.com/sf-category-menu/ 4 4 Tags: child, pages, posts, categories, menu, treeview, tree, list, widget 5 5 Requires at least: 3.8 6 Tested up to: 4.4. 16 Tested up to: 4.4.2 7 7 Stable tag: trunk 8 8 License: GPLv2 … … 13 13 == Description == 14 14 Plugin is based on jQuery Treeview Plugin and gives an easy Treeview Menu for WordPress categories. It will display the current page or category and all child pages. 15 [Plugin website](http s://studiofreya.com/wordpress/wordpress-plugins/sf-category-menu/)15 [Plugin website](http://www.studiofreya.com/sf-category-menu/) 16 16 17 17 = Features: = … … 20 20 * Translation ready 21 21 * Doesn't show empty categories 22 * Caching of the menu22 * Shortcode to list categories with thumbnails 23 23 24 24 = Live demo: = … … 31 31 1. Use it as a Widget 32 32 33 See [custom styling examples](https://studiofreya.com/wordpress/wordpress-plugins/sf-category-menu/styling/).33 See custom [Styling examples](http://studiofreya.com/wordpress-plugins/sf-category-menu/styling/). 34 34 35 35 == Frequently Asked Questions == 36 36 37 [ SF Category Menu plugin FAQ](https://studiofreya.com/wordpress/wordpress-plugins/sf-category-menu/faq/)37 [Plugin page](http://studiofreya.com/sf-category-menu/) 38 38 39 39 == Screenshots == … … 44 44 == ChangeLog == 45 45 46 [SF Category Menu Changelog](https://studiofreya.com/wordpress/wordpress-plugins/sf-category-menu/changelog/).46 SF Category Menu [change log](http://studiofreya.com/wordpress-plugins/sf-category-menu/changelog/). 47 47 48 48 == Upgrade Notice == -
sf-category-menu/trunk/sf-category-menu.php
r1326085 r1404409 3 3 /** 4 4 * Plugin Name: SF Category Menu Widget 5 * Plugin URI: http ://studiofreya.com/sf-category-menu/5 * Plugin URI: https://studiofreya.com/sf-category-menu/ 6 6 * Description: Easy treeview menu for WordPress categories, with catergory caching 7 * Version: 1. 47 * Version: 1.5 8 8 * Author: Studiofreya AS 9 9 * Author URI: http://studiofreya.com … … 246 246 add_action( 'plugins_loaded', 'sf_category_init' ); 247 247 248 //show categories with thumbnails 249 function wpb_list_categories_with_thumbnails($attributes) { 250 $categories = get_categories(); 251 $exclude_arr = array(); 252 253 extract( shortcode_atts( array( 254 'exclude' => array() 255 ), $attributes ) ); 256 257 if(!empty($exclude)) { 258 $exclude_arr = explode(",", $exclude); 259 } 260 261 $sticky_posts_used = array(); 262 263 echo '<ul class="category_row">'; 264 foreach ($categories as $cat) { 265 266 $continue = 1; 267 foreach($exclude_arr as $exclude) { 268 269 if($cat->cat_ID == $exclude) 270 { 271 $continue = 0; 272 break; 273 } 274 } 275 276 if($continue == 0) { 277 continue; 278 } 279 280 if ($cat->category_parent == 0) { 281 echo '<li>'; 282 $output = '<a href="'.get_category_link( $cat->term_id ).'">'; 283 echo trim($output, ' '); 284 285 //try sticky first 286 $args = array( 'category' => $cat->cat_ID, 'post__in' => get_option( 'sticky_posts') ); 287 $posts = get_posts($args); 288 $sticky_found = false; 289 if($posts) { 290 foreach( $posts as $post ) { 291 292 $used = false; 293 //check if alreade in use 294 foreach($sticky_posts_used as $sticky) { 295 if($post->ID == $sticky) { 296 $used = true; 297 break; 298 } 299 } 300 301 if(!$used) { 302 setup_postdata($post); 303 echo '<div class="category_thumb">'; 304 echo get_the_post_thumbnail($post->ID, array(150,150)); 305 echo '</div>'; 306 307 $sticky_found = true; 308 array_push($sticky_posts_used, $post->ID); 309 break; 310 } 311 } 312 } 313 314 if(!$sticky_found) { 315 //show each 3 thumbnail in a category 316 $post_number = $cat->count > 1 ? ($cat->count > 2 ? 3 : 2) : 1; 317 $args = array( 'posts_per_page' => 3, 'category' => $cat->cat_ID ); 318 $posts = get_posts($args); 319 if( $posts ) { 320 $counter = 1; 321 foreach( $posts as $post ) { 322 if($counter == $post_number) { 323 setup_postdata($post); 324 echo '<div class="category_thumb">'; 325 echo get_the_post_thumbnail($post->ID, array(150,150)); 326 echo '</div>'; 327 } 328 $counter++; 329 } 330 } 331 } 332 echo '<div class="category_name">'; 333 $cat_name = explode(' ',trim($cat->name)); 334 echo $cat_name[0]; 335 echo ' <span class="category_name_count">('; 336 echo sf_getPostCount($cat->cat_ID); 337 echo ')</span></div>'; 338 echo '</a></li>'; 339 } 340 } 341 342 dynamic_sidebar( 'widget-area-frontpage-thumbnail' ); 343 344 echo '</ul>'; 345 } 346 347 add_shortcode('list_categories_thumbnails', 'wpb_list_categories_with_thumbnails'); 348 248 349 249 350 ?>
Note: See TracChangeset
for help on using the changeset viewer.