SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2012
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Twenty Twelve Featured Image Size

    I have made a site using a child theme of Twenty Twelve.

    http://www.telluridemountainclub.org/

    I'm trying to make a change so that when the "Featured Image" is specified for a post it shows up above the post as a smaller size that the Twenty Twelve default of 624 px wide.

    i have read about how to do this and got some advice from the WP support forum but I cannot get it o work.

    I have a functions.php file in my child theme that contains only the following code:

    <?php
    if ( function_exists( 'set_post_thumbnail_size' ) ) {
    set_post_thumbnail_size( 100, 100, true );
    }

    I think that should work, but it doesn't. On advice from a well respected WP support forum regular I tried :

    function my_theme_thumb() {
    set_post_thumbnail_size( 100, 100, true );
    }
    add_action( 'after_setup_theme', 'my_theme_thumb' );

    That doesn't work either. For some reason the function always continues to use the parent Twenty Twelve featured image size of 624px wide. I've tried a bunch of other stuff but just can't figure out how to get control of the Featured Image thumbnail size.

    Any help or advice will be very much appreciated.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,097
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Could you link us to a page that has such an image on it, or specify an example of that image? You can set images sizes with CSS, so I was looking into that, but I don't know what to look at.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2012
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your reply Ralph. here is a link to a page of posts. The top image is set (in the WP dashboard) as the "Featured Image" for that post. My understanding is that the size of the "Featured Image" is controlled by a php function in the functions.php file, not really by css. I want to have my child theme functions.php file control that size (per WP best practice / recommended method). As you can see, the image is being shown at the parent Twenty Twelve functions.php default size of 624px wide. I can't seem to add the correct code to my child theme functions.php.... or perhaps there is some other problem with one other child theme template files.

    http://www.telluridemountainclub.org...y/trip-report/

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,097
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Yeah, I can't help with the PHP bit, but you do have the option to do something like this in your CSS:

    Code:
    .entry-header img {width: 550px;}
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."

  5. #5
    SitePoint Enthusiast
    Join Date
    Mar 2012
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks but that will cause other problems in the WP functionality. There are other WP related things that acccess the Featured Image and it is possible, if one can only figure it out, to have it display at different sizes in different locations with in the site The way I'm trying to get this done is the recommended technique per WP codex and all best practice advice. I'm just not getting how to do it and need some WP specific help.

    Thanks again!

  6. #6
    SitePoint Enthusiast
    Join Date
    Mar 2012
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey a helpful person on the WP forum provided the answer.

    "It needs to hook in with later order, the default is 10, try 11."

    I needed to add an order number "11" to the function. See below.

    function my_theme_thumb() {
    set_post_thumbnail_size( 100, 100, true );
    }
    add_action( 'after_setup_theme', 'my_theme_thumb', 11 );

    Now it works!

  7. #7
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,097
    Mentioned
    448 Post(s)
    Tagged
    8 Thread(s)
    Thanks for posting the answer. I'm sure this will help out someone else some time.
    Facebook | Google+ | Twitter | Web Design Tips | Free Contact Form

    Forum Usage: Tips on posting code samples, images and more

    Forrest Gump: "IE is like a box of chocolates: you never know what you're gonna get."


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •