Plugin Directory

Changeset 1078238


Ignore:
Timestamp:
01/29/2015 02:50:13 PM (11 years ago)
Author:
blocknot.es
Message:

Added 'cat_id' param to cfi_featured_image

Location:
category-featured-images/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • category-featured-images/trunk/category-featured-images.php

    r1049144 r1078238  
    44 * Plugin URI: https://github.com/blocknotes/wordpress_category_featured_images
    55 * 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.5
     6 * Version: 1.1.8
    77 * Author: Mattia Roccoberton
    88 * Author URI: http://blocknot.es
     
    9090        }
    9191        else $size = 'thumbnail';
    92         if( is_single() )
     92        if( isset( $args['cat_id'] ) )
     93        {
     94            $cat_id = intval( $args['cat_id'] );
     95            $images = get_option( 'cfi_featured_images' );
     96            if( isset( $images[$cat_id] ) )
     97            {
     98                $img = wp_get_attachment_image( $images[$cat_id], $size );
     99                if( !empty( $img ) ) return '<span class="cfi-featured-image">' . wp_get_attachment_image( $images[$cat_id], $size ) . '</span>';
     100            }
     101        }
     102        else if( is_single() )
    93103        {
    94104            $image = get_the_post_thumbnail( null, $size, $args );
  • category-featured-images/trunk/readme.txt

    r1049144 r1078238  
    2424* 'alt': alternative text of the image tag
    2525* 'title': title of the image tag
     26* 'cat_id': select a specific category id
    2627
    2728Shortcode example:
     
    3637
    3738    cfi_featured_image_url( array( 'size' => 'large' ) );
    38 
    39 cfi_featured_image_url extra argument:
    40 
    41 * 'cat_id': get the image URL of a specific category id
    4239
    4340Notes:
     
    5855== Upgrade Notice ==
    5956
     57= 1.1.8 =
     58* Added 'cat_id' param to cfi_featured_image
    6059= 1.1.5 =
    6160* Loads parent category image if nothing is found before
     
    7069== Changelog ==
    7170
     71= 1.1.8 =
     72* Added 'cat_id' param to cfi_featured_image
    7273= 1.1.5 =
    7374* Loads parent category image if nothing is found before
Note: See TracChangeset for help on using the changeset viewer.