WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] add_image_size() not working (6 posts)

  1. Vrunda Pandya
    Member
    Posted 1 year ago #

    Hi,
    I add below code to change thumbnai size + to add custom image size but it's not work i also use it previously in many templates but in my new template it's not work i can't find the mistake, i add this code in functions.php, can anyone help me ???

    if ( function_exists( 'add_theme_support' ) ) {
    add_theme_support('post-thumbnails');
    set_post_thumbnail_size(125, 75); // default Post Thumbnail
    add_image_size('detail_page_image',570, 400, false);//(cropped)
    add_image_size('listing_img',125, 85, false);//(cropped)
    }

  2. keesiemeijer
    moderator
    Posted 1 year ago #

    Have you altered the image size argument in the functions in your theme template files that show a post thumbnail?

    the_post_thumbnail();
    the_post_thumbnail('detail_page_image');
    the_post_thumbnail('listing_img');

    http://codex.wordpress.org/Function_Reference/add_image_size

  3. Vrunda Pandya
    Member
    Posted 1 year ago #

    thanks you keesiemeijer

    No i don't alter any arguments in template file, i just write the code as i mention above. please help me to solve it.

  4. keesiemeijer
    moderator
    Posted 1 year ago #

    What theme are you using? And where do you want these new image sizes to appear (categories, single posts, pages ...)

  5. Vrunda Pandya
    Member
    Posted 1 year ago #

    i want new image size for single page and category page and it's custom taxonomy not for posts and pages , but image size is not added even for posts too. and i am creating my own theme not using any built in template.

    in which cases add_image_size() will not work.....

  6. keesiemeijer
    moderator
    Posted 1 year ago #

    i want new image size for single page and category page and it's custom taxonomy

    Did you change the_post_thumbnail to the new size in single.php,category.php and taxonomy.php.

    To change the default post thumbnail size, you'll have to change this (depending on your theme):

    <?php  the_post_thumbnail(); ?>

    To this

    <?php  the_post_thumbnail('detail_page_image'); ?>

    but image size is not added even for posts too

    Do you see the post thumbnails on the front end but not in the right size after altering your theme template files?
    Try to regenarate your post thumbnails with a plugin: http://wordpress.org/extend/plugins/regenerate-thumbnails/
    Only do this after a full backup of your database and images.
    http://codex.wordpress.org/WordPress_Backups

Topic Closed

This topic has been closed to new replies.

About this Topic