How to display child page from specific parent page in homepage?

How do I create multiple custom-sized featured post images for WordPress to display on the homepage?

  • I want to be able to set a featured image for each wordpress page that I create that will display the featured image on the index page.  The images will need to be different sizes, and should display with the different sixes on the homepage.  The items will also need to have the css shadow property applied to it, so resizing in photoshop and loading the pre-resized item is not an option.

  • Answer:

    Wordpress 3 has this built right in.  All you have to do is declare the image sizes in your theme's functions.php file like so: if ( function_exists( 'add_theme_support' ) ) add_theme_support( 'post-thumbnails' ); if ( function_exists( 'add_image_size' ) ) { add_image_size( 'category-thumb', 200, 200 ); add_image_size( 'homepage-thumb', 220, 180, true ); } The first part enables post thumbnails and the second declares the image sizes you want.  If you add TRUE to the image size declaration it will hard crop the image. Then in each post you can set the post thumbnail (featured image) in the the sidebar on the right side.  In your templates you will need to call the correct image eg: category-thumb in the correct place like so: if ( has_post_thumbnail() ) the_post_thumbnail( 'category-thumb' ); You should also consider installing a thumbnail rebuilding plugin in case you ever decide to change the sizes of the thumbs.  Use http://wordpress.org/extend/plugins/ajax-thumbnail-rebuild/.

Stuart Starr at Quora Visit the source

Was this solution helpful to you?

Other answers

Adding code to a functions.php file and using a plugin are both good options depending on your situation. A functions.php file, living in an individual theme directory, taps into, as mentioned above, the core functionality of WordPress. The directness of this connection may be a desirable factor if you expect that the site manager will continue to use the current theme or are advise of the potential issues of changing their theme. Copy/pasting the functions.php file to a new theme will work in most situations. Moving functions from a standard theme to one with a premium theme or theme framework with proprietary tagging may present an issue. A plug-in, usually living in the plugins directory, is, again usually, designed to work with any active themes on a site, though some plugins may require the addition of particular code to a theme for them to work. The drawback is that the site will increase its dependence on third-party developers who may or may not continue to upgrade their product to work as WordPress continues to update. Hope this helps. Diana

Diana Thompson

We use "timthumb" to resize wordpress images on the fly (and then cache them). This way you can resize any wordpress image to any size you want. As far as I know Wordpress is not providing any settings to do that. http://www.darrenhoyt.com/2008/04/02/timthumb-php-script-released/

Max Schulze

Try "Get the Image" plugin by Justin Tadlock, Creator of Theme Hybrid. I believe it's perfect for what you're trying to accomplish. If you need more information on how it works and what it does, check out Justin's blog. He does great job of documenting and maintaining all his work. Justin's Post on the Plugin http://justintadlock.com/archives/2008/05/27/get-the-image-wordpress-plugin Get the Image Plugin on http://WordPress.org http://wordpress.org/extend/plugins/get-the-image/

Ben Ackles

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.