WordPress.org

Ready to get started?Download WordPress

Plugin Directory

!This plugin hasn't been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

Author Image(s)

Version: 3.6 Display image (if present) and/or name for the author of a post, or for all authors on the blog.

Template Tags

The plugin provides three optional template tags for use in your theme templates.

Functions

  • function c2c_get_author_image( $args = array() ) Gets the image and/or name for an author.

  • function c2c_the_author_image( $before = '', $after = '', $image_dir = '', $width = '', $height = '' ) A drop-in replacement for WordPress's the_author() , allowing the author for the post to have an image displayed in lieu of the name (if an image can be found).

  • function c2c_wp_list_authors_images( $args = '' ) A drop-in replacement for WordPress's wp_list_authors(), allowing all authors for a blog to be listed with an image (if present).

This displays the image associated with a post's categories.

Arguments

  • $before Optional argument. The text and/or HTML to appear before the author image/text, if any such text would be returned.

  • $after Optional argument. The text and/or HTML to appear after the author image/text, if any such text would be returned.

  • $image_dir Optional argument. The directory, relative to the root of your blog, in which to find the author images. If not set, it defaults to the value configured via the plugin's admin options page.

  • $width Optional argument. The forced width of the image (will cause browser to resize if image is of different width). Leave blank to retain image's original width (or for the width to be scaled in proportion to a specified height). It is recommended that images exist at the desired size.

  • $height Optional argument. The forced height of the image (will cause browser to resize if image is of different height). Leave blank to retain image's original height (or for the height to be scaled in proportion to a specified width). It is recommended that images exist at the desired size.

  • $author_id Optional argument. The id of the author. If null, then gets the author for the current post. Default is null.

  • $args (as used in c2c_get_author_image()) Optional argument. An array of configuration options.

    • author_id : default of current post author; the id of the author to get the image for
    • before : default of ''; text to show before each author
    • after : default of ''; text to show after each author
    • image_dir : default of ''; directory containing author images, relative to wp-content directory
    • width : default of ''; width to display image
    • height : default of ''; height to display image
    • show_name : default of '' which means it'll abide by the plugin's setting value; should the name of the author be shown in addition to the image?
    • show_fullname : default of false; should the user's first and last name be shown instead of the author's configured display name? (be sure to set 'show_name' to true if you want the name to appear in the first place)
    • show_name_if_no_image : default of '' which means it'll abide by the plugin's setting value; should the author's name be shown if the author doesn't have an image?
    • class : default of ''; array or string of classes to apply to author image tag
    • use_gravatar : default of plugin settings; should Gravatar be consulted for an author image if no local image for the author was found?
  • $args (as used in c2c_wp_list_authors_images) Optional argument. An array of configuration options. All but the last two match up with the supported arguments of the wp_list_authors() function.

    • optioncount : default of false;
    • exclude_admin : default of true; should the admin user be excluded from the listing?
    • hide_empty : default of true; should authors who have not made any posts be excluded from the listings?
    • feed : default of ''
    • feed_image : default of ''
    • echo : default of true; should the listing be echoed to the page?
    • show_name : default of '' which means it'll abide by the plugin's setting value; should the name of the author be shown in addition to the image?
    • show_fullname : default of false; should the user's first and last name be shown instead of the author's configured display name? (be sure to set 'show_name' to true if you want the name to appear in the first place)
    • show_name_if_no_image : default of '' which means it'll abide by the plugin's setting value; should the author's name be shown if the author doesn't have an image?
    • before : default of ''; text to show before each author
    • after : default of ''; text to show after each author
    • image_dir : default of ''; directory containing author images, relative to wp-content directory
    • width : default of ''; width to display image
    • height : default of ''; height to display image
    • class : default of ''; array or string of classes to apply to author image tag
    • use_gravatar : default of plugin settings; should Gravatar be consulted for an author image if no local image for the author was found?

Examples

  • Show the author image for the current post's author (must be "in the loop")
<?php c2c_the_author_image(); ?>
  • Get the author image from a different directory when on a post's permalink page (for instance, show a larger image on the permalink page)
<?php c2c_the_author_image( '', '', (is_single() ? 'wp-content/images/authors/large' : '') ); ?>
  • List all authors in the sidebar
<ul>
  <?php c2c_wp_list_authors_image(); ?>
</ul>
  • Change some default options when listing authors
<ul>
  <?php c2c_wp_list_authors_image(array('exclude_admin' => false, 'show_name_if_no_image' => true)); ?>
</ul>

Filters

The plugin exposes two filters and two actions for hooking. Typically, customizations utilizing these hooks would be put into your active theme's functions.php file, or used by another plugin.

c2c_get_author_image (filter)

The 'c2c_get_author_image' hook allows you to use an alternative approach to safely invoke c2c_get_author_image() in such a way that if the plugin were deactivated or deleted, then your calls to the function won't cause errors in your site.

Arguments:

  • same as for c2c_get_author_image()

Example:

Instead of:

`<?php $image = c2c_get_author_image( array( 'show_name' => false ) ); ?>`

Do:

`<?php $image = apply_filters( 'c2c_get_author_image', array( 'show_name' => false ) ); ?>`

c2c_get_the_author_image (filter)

The 'c2c_get_the_author_image' hook allows you to use an alternative approach to safely invoke c2c_get_the_author_image() in such a way that if the plugin were deactivated or deleted, then your calls to the function won't cause errors in your site.

Arguments:

  • same as for c2c_get_the_author_image()

Example:

Instead of:

`<?php $image = c2c_get_the_author_image(); ?>`

Do:

`<?php $image = apply_filters( 'c2c_get_the_author_image', ''); ?>`

c2c_the_author_image (action)

The 'c2c_the_author_image' hook allows you to use an alternative approach to safely invoke c2c_the_author_image() in such a way that if the plugin were deactivated or deleted, then your calls to the function won't cause errors in your site.

Arguments:

  • same as for c2c_the_author_image()

Example:

Instead of:

`<?php c2c_the_author_image( '<span class="author">', '</span>', '/images' ); ?>`

Do:

`<?php echo do_action( 'c2c_the_author_image', '<span class="author">', '</span>', '/images' ); ?>`

c2c_wp_list_authors_images (action)

The 'c2c_wp_list_authors_images' hook allows you to use an alternative approach to safely invoke c2c_wp_list_authors_images() in such a way that if the plugin were deactivated or deleted, then your calls to the function won't cause errors in your site.

Arguments:

  • same as for c2c_wp_list_authors_images()

Example:

Instead of:

`<?php echo c2c_wp_list_authors_images( array( 'hide_empty' => false ) ); ?>`

Do:

`<?php echo do_action( 'c2c_wp_list_authors_images', array( 'hide_empty' => false ) ); ?>`

Requires: 3.1 or higher
Compatible up to: 3.3.2
Last Updated: 2012-1-4
Downloads: 18,404

Ratings

4 stars
4 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1
100,3,3
100,1,1
100,1,1
0,2,0
100,1,1
50,2,1
0,1,0