Changeset 1041737
- Timestamp:
- 12/10/2014 07:57:06 AM (11 years ago)
- Location:
- category-featured-images/trunk
- Files:
-
- 2 edited
-
category-featured-images.php (modified) (4 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
category-featured-images/trunk/category-featured-images.php
r1006858 r1041737 4 4 * Plugin URI: https://github.com/blocknotes/wordpress_category_featured_images 5 5 * Description: Allows to set featured images for categories, posts without a featured image will show the category's image (Posts \ Categories \ Edit category) 6 * Version: 1.1. 06 * Version: 1.1.2 7 7 * Author: Mattia Roccoberton 8 8 * Author URI: http://blocknot.es … … 33 33 { 34 34 $size = isset( $args['size'] ) ? $args['size'] : 'full'; 35 if( is_single() ) 35 if( isset( $args['cat_id'] ) ) 36 { 37 $cat_id = intval( $args['cat_id'] ); 38 $images = get_option( 'cfi_featured_images' ); 39 if( isset( $images[$cat_id] ) ) 40 { 41 $attachment = wp_get_attachment_image_src( $images[$cat_id], $size ); 42 if( $attachment !== FALSE ) return $attachment[0]; 43 } 44 } 45 else if( is_single() ) 36 46 { 37 47 $id = get_post_thumbnail_id(); … … 47 57 if( $categories ) 48 58 { 59 $images = get_option( 'cfi_featured_images' ); 49 60 foreach( $categories as $category ) 50 61 { 51 $images = get_option( 'cfi_featured_images' );52 62 if( isset( $images[$category->term_id] ) ) 53 63 { … … 79 89 if( $categories ) 80 90 { 91 $images = get_option( 'cfi_featured_images' ); 81 92 foreach( $categories as $category ) 82 93 { 83 $images = get_option( 'cfi_featured_images' );84 94 if( isset( $images[$category->term_id] ) ) return '<span class="cfi-featured-image">' . wp_get_attachment_image( $images[$category->term_id], $size ) . '</span>'; 85 95 } -
category-featured-images/trunk/readme.txt
r1006858 r1041737 31 31 Function example 2: cfi_featured_image_url( array( 'size' => 'large' ) ); 32 32 33 cfi_featured_image_url extra argument: 34 35 * 'cat_id': get the image URL of a specific category id 36 33 37 == Installation == 34 38 … … 43 47 == Upgrade Notice == 44 48 49 = 1.1.2 = 50 * Added 'cat_id' param to cfi_featured_image_url 45 51 = 1.1.0 = 46 52 * Improved cfi_featured_image in category archive pages … … 51 57 == Changelog == 52 58 59 = 1.1.2 = 60 * Added 'cat_id' param to cfi_featured_image_url 53 61 = 1.1.0 = 54 62 * Improvement: cfi_featured_image in category archive pages shows the current image
Note: See TracChangeset
for help on using the changeset viewer.