WordPress.org

Ready to get started?Download WordPress

Forums

How can I change the size of my posts content thumbnails? (4 posts)

  1. rileybetka
    Member
    Posted 1 year ago #

    It seems like this should be really easy to do. I have tried putting a functions.php in my child theme folder and adding:
    if ( function_exists( 'add_theme_support' ) ) {
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 150, 150 );
    }

    and this changes nothing.
    I also tried creating a content.php in my childtheme folder and adding values in the parenthesis on this line:
    <?php the_post_thumbnail(); ?>

    and this is not changing anything either.

    the site I am working with is http://www.daily-mash.com - thanks in advance for your help!

  2. paulwpxp
    Font hero
    Posted 1 year ago #

    Did you assign an image to be the featured image of that post/page yet ?

    Which part of the template that you place the_post_thumbnail() in ?

    Do you see the <img/> in the frontend at all, if so what are the classes there ?

  3. rileybetka
    Member
    Posted 1 year ago #

    I just opened the content.php and put some values in - the line was already there...

  4. paulwpxp
    Font hero
    Posted 1 year ago #

    the_post_thumbnail() must be used inside the loop, the file name content.php alone doesn't guarantee if it's inside the loop, it depends on how the theme is constructed.

    So, just check if it's called inside the loop.

    Second, make sure if it's the right content.php. If the theme is using content.php as standard WP theming, make sure that the post/page you are viewing is really using the default content.php ( because you said you place the_post_thumbnail() inside this file ). For emample, if the theme has post formats and the content-format.php is being used, or it might becontent-page.php

    The <img/> echoed to the front will tell if the_post_thumbnail() works, it will output the correct classes.

    If everything's done right BUT you didn't assign the image to be a featured for that post/page, you are not gonna see it output as well.

Topic Closed

This topic has been closed to new replies.

About this Topic