I want to smaller my post thumbnails from 825px to something like 150x150. I'm using the newest version of wordpress and the "sark press" theme.

So this is my code:


function sarkpress_render_post_thumbnail() {
if ( post_password_required() || ! has_post_thumbnail() ) {

if ( is_singular() ) :

<div class="post-thumbnail" itemprop="thumbnail">
<?php the_post_thumbnail('square-150'); ?>

<?php else : ?>

<a class="post-thumbnail" href="<?php the_permalink(); ?>">
<?php the_post_thumbnail('square-150'); ?>

<?php endif; ?> // End is_singular()



include_once( get_template_directory().'/inc/sarkpress-function.php');

function sarkpress_setup() {

    if ( ! isset( $GLOBALS['$content_width'] ) ) { $GLOBALS['$content_width'] = 825; }
    add_theme_support( 'automatic-feed-links' );    
    add_theme_support( 'html5', array( 'search-form' ) );

    register_nav_menu( 'primary', 'Primary Menu' ); 

    add_image_size( 'square-150', 150, 150, true );
add_action( 'after_setup_theme', 'sarkpress_setup' );

But it doesn't work?! My thumbnails are still 825px big.

I also tried to change the 825 at the following line in the code

$GLOBALS['$content_width'] = 825;

to something smaller, but that also didn't change anything. What am I doing wrong?

1 Answer 1


First add the following code to your theme functions.php:

add_image_size( 'square-150', 150, 150, true )

In sarkpress-function.php file, change this line:

<?php the_post_thumbnail(); ?>


<?php the_post_thumbnail('square-150'); ?>

You would have to regenerate your images by using Regenerate Thumbnails plugin


  • Nope that doesn't work for me. I edited the above code so you can see to what I changed it to. BTW: you missed a ';' at the end of "add image size".
    – winklerrr
    Commented Apr 6, 2015 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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