Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

A followup to my previous question about my theme that was rejected for the WordPress.org theme directory:

  • RECOMMENDED: No reference to the_post_thumbnail() was found in the theme. It is recommended that the theme implement this functionality instead of using custom fields for thumbnails.
  • RECOMMENDED: No reference to add_custom_image_header was found in the theme. It is recommended that the theme implement this functionality if using an image for the header.

How do I correct it? This is my function:

// thumbnail list 
function retImage($content){
     $pattern="/<img.*?src=[\'|\"](.*?(?:[\.gif|\.jpg]))[\'|\"].*?[\/]?>/";
     preg_match_all($pattern,$content,$match); 
     if(empty($match[0][0])){
                 echo "<img src=\"";
                 bloginfo('template_url');
                 echo "/images/thumbnail.png\" />";
     }else{
         echo  $match[0][0];
     }
}

I used an image for the header by css, why do they say this:

  • RECOMMENDED: No reference to add_custom_image_header was found in the theme.

Header image CSS rules

  • Embedded videos overlap sidebar. Please set the content_width variable

In my the functions.php of my theme I did this:

if ( ! isset( $content_width ) )
    $content_width = 992;

Why do they still give me that tip?

share|improve this question
1  
Is there some reason that you're asking these questions on WPSE, rather than in the Trac ticket, or via the theme-reviewers mail list? –  Chip Bennett May 31 '11 at 11:43
1  
@Chip Bennet: Yes, he’s getting upvotes here. :) –  toscho May 31 '11 at 11:57
    
(That was my up-vote ;) ). Up-votes are nice and all, but they're not necessarily useful toward getting one's Theme approved... –  Chip Bennett May 31 '11 at 12:07

1 Answer 1

up vote 5 down vote accepted

RECOMMENDED: No reference to the_post_thumbnail() was found in the theme. It is recommended that the theme implement this functionality instead of using custom fields for thumbnails.

This is because you are not using the_post_thumbnail() in your theme, you are trying to get an image from the post content. This means there is no way for a user to explicitly set which image is shown wherever you are using retImage(). I would include the ability for retImage() to try use the thumbnail, something like:

// thumbnail list 
function retImage($content) {

    if( has_post_thumbnail() )
         return the_post_thumbnail( 'thumbnail' ); 

    $pattern="/<img.*?src=[\'|\"](.*?(?:[\.gif|\.jpg]))[\'|\"].*?[\/]?>/";
    preg_match_all($pattern,$content,$match); 
    if(empty($match[0][0])){
             echo "<img src=\"";
             bloginfo('template_url');
             echo "/images/thumbnail.png\" />";
    } else {

        echo  $match[0][0];
    }
}

You may also need to include add_theme_support( 'post-thumbnails' ) in your functions.php

RECOMMENDED: No reference to add_custom_image_header was found in the theme. It is recommended that the theme implement this functionality if using an image for the header.

If you theme has a header image, it is recommended to use the WordPress header image API, you can find out more about it here: http://codex.wordpress.org/Function_Reference/add_custom_image_header

This would enable the user to change the header image via the admin (Appearance -> Custom Header) or something alike.

Embedded videos overlap sidebar. Please set the content_width variable The $content_width should be a global variable:

global $content_width;
$content_width = 960;
share|improve this answer
    
if i want to do a fixed image to my theme's header.namely, not make the user can change the header. how do i do? –  enjoylife May 31 '11 at 10:49
    
i am also find some themes form the wordpress.org whose using a header image by css. –  enjoylife May 31 '11 at 10:50
    
do you know questions 3. why i get "Please set the content_width variable" tip? –  enjoylife May 31 '11 at 10:52
1  
Re the header: It's just a recommendation - if you don't want the ability for the user to change the header, don't do include it. Any other themes on the repo that don't let you change the image would also come up against this warning. –  Joe Hoyle May 31 '11 at 11:04
1  
@enjoylife: The $content_width should be the width of your main content area (where you display the blog text), not including the sidebars. I suspect the 992 pixels is the width of the whole theme? For Twenty Ten it's 640, for example. –  Jan Fabry May 31 '11 at 11:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.