Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author KOB

    (@kobenland)

    Hey Eric,

    thank you for your feedback!

    Honestly I never really thought about the need to delete headers – I figured you would just not use them. As you would with the regular header images a theme comes with.

    Just so we are on the same page: You expect the image files to be deleted from the server, when you hit ‘Delete Permanently’ in the Media Library, correct?

    Let me look into that over the weekend and get back to you on this, okay?

    Plugin Author KOB

    (@kobenland)

    Hey Erik,

    I just committed version 1.2 with fixes for the problems you mentioned. Let me know how you like it!

    Thread Starter eriktdesign

    (@eriktdesign)

    Hi Konstantin,

    Just updated the plugin–that’s great! Thumbs now show up properly in the media gallery, and remove from the headers list as expected.

    I’m using your plugin to allow for user uploads to the site for a rotating header image (ie, each page load, new random image). Here’s the code I’m using in my functions.php:

    if (!function_exists('get_random_header_image')) :
    /**
     * Returns a random header image from the defaults list.
     * Use in conjunction with WP Save Custom Header to allow user uploads
     */
    function get_random_header_image() {
    $posts = get_posts(array(
          'numberposts'	=>	1,
          'post_type'	=>	'attachment',
          'meta_key'	=>	'_header_image',
          'orderby'	=>	'rand',
        ));
    
        foreach($posts as $post) {
    	$meta = get_post_meta( $post->ID, '_wp_attachment_metadata' );
        	$meta = ( 1 == count($meta) ) ? $meta[0] : $meta;
    	if(!empty($meta) AND is_array($meta)) {
    		if($meta['file']) {
    			echo '<img src="' . get_bloginfo('stylesheet_directory') . '/images/headers/' . $meta['file'] . '" width="' . HEADER_IMAGE_WIDTH . '" height="' . HEADER_IMAGE_HEIGHT . '" alt="" />';
    		return true;
    		}
        	}
        }
        return false;
    }
    endif;

    I imagine that might be out of the scope for your plugin, but I wanted to share it! Thanks for the great work!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WP Save Custom Header] Header image thumbnails not displayed in media library’ is closed to new replies.