WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] twentyten - how to see uploaded headers in admin (2 posts)

  1. webjuly31
    Member
    Posted 3 years ago #

    I uploaded new header images plus the thumbnails thinking I would see them on the header page where you can see all the other choices, however, they did not appear.

    What do I need to make them appear?

  2. Digital Raindrops
    Member
    Posted 3 years ago #

    They are added in code in functions.php, if you want to add new images have a look at using a child theme, this tutorial adds three new images.
    http://aaron.jorb.in/blog/2010/04/introducing-thirty-ten/

    If you want to get clever then there is another post on that website to unregister all the wordpress headers.

    I use a function and build the array in a child theme from the file names in the folder.

    /* Build the Header Array from the theme headers */
    // No need to code the headers just loop through the folder and return a list
    function cms_theme_headers() {
    	global $themename;
        $list = array();
    	$imagepath = STYLESHEETPATH .'/images/headers/';
    	$imageurl = get_bloginfo('stylesheet_directory');
        $dir_handle = @opendir($imagepath) or die("Unable to open $path");
        while($file = readdir($dir_handle)){
            if($file == "." || $file == ".."){continue;}
            $filename = explode(".",$file);
            $cnt = count($filename); $cnt--; $ext = $filename[$cnt];
            if(strtolower($ext) == ('png' || 'jpg')){
       	 	  if (!strpos($file, '-thumbnail') > 0) {
    				$header = array(
    					'url' => $imageurl .'/images/headers/' .$file,
    					'thumbnail_url' => $imageurl .'/images/headers/' .$filename[0] .'-thumbnail.' .$ext,
    					'description' => __( $filename[0], $themename )
    				);
    				array_push($list, $header);
    		  }
            }
        }
        return $list;
    }

    Called like:

    //Add our Own Theme Headers
    register_default_headers( cms_theme_headers() );

    David

Topic Closed

This topic has been closed to new replies.

About this Topic