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.
- 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?
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 usingretImage()
. I would include the ability forretImage()
to try use the thumbnail, something like:You may also need to include
add_theme_support( 'post-thumbnails' )
in yourfunctions.php
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.