Plugin Directory

Changeset 1041737


Ignore:
Timestamp:
12/10/2014 07:57:06 AM (11 years ago)
Author:
blocknot.es
Message:

Added 'cat_id' param

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

Legend:

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

    r1006858 r1041737  
    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.0
     6 * Version: 1.1.2
    77 * Author: Mattia Roccoberton
    88 * Author URI: http://blocknot.es
     
    3333    {
    3434        $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() )
    3646        {
    3747            $id = get_post_thumbnail_id();
     
    4757            if( $categories )
    4858            {
     59                $images = get_option( 'cfi_featured_images' );
    4960                foreach( $categories as $category )
    5061                {
    51                     $images = get_option( 'cfi_featured_images' );
    5262                    if( isset( $images[$category->term_id] ) )
    5363                    {
     
    7989            if( $categories )
    8090            {
     91                $images = get_option( 'cfi_featured_images' );
    8192                foreach( $categories as $category )
    8293                {
    83                     $images = get_option( 'cfi_featured_images' );
    8494                    if( isset( $images[$category->term_id] ) ) return '<span class="cfi-featured-image">' . wp_get_attachment_image( $images[$category->term_id], $size ) . '</span>';
    8595                }
  • category-featured-images/trunk/readme.txt

    r1006858 r1041737  
    3131Function example 2: cfi_featured_image_url( array( 'size' => 'large' ) );
    3232
     33cfi_featured_image_url extra argument:
     34
     35* 'cat_id': get the image URL of a specific category id
     36
    3337== Installation ==
    3438
     
    4347== Upgrade Notice ==
    4448
     49= 1.1.2 =
     50* Added 'cat_id' param to cfi_featured_image_url
    4551= 1.1.0 =
    4652* Improved cfi_featured_image in category archive pages
     
    5157== Changelog ==
    5258
     59= 1.1.2 =
     60* Added 'cat_id' param to cfi_featured_image_url
    5361= 1.1.0 =
    5462* Improvement: cfi_featured_image in category archive pages shows the current image
Note: See TracChangeset for help on using the changeset viewer.