i have multisite with many blog. i can display the post

hi, i have multisite with many blog. i can display the post thumbnail, but the thumbnail size is 150px X 150px. so, how to resize my post thumbnail? and this is my code in functions.php

if( function_exists( 'add_theme_support' ) ) {

	add_theme_support( 'post-thumbnails' );
	add_theme_support( 'homepostthumbnails' ); 

  add_image_size( 'thumbone', 55, 45, true );
  add_image_size( 'thumbtwo', 418, 215, true );
  }

thank's

  • Mindblaze
    • The Incredible Code Injector

    Hi, Welcome to the community!

    First thing is first, in your multisite, do you have different themes on your blog or just one theme applied to every single one?

    Next, you will need to use the function :

    set_post_thumbnail_size( $width, $height, $crop );

    Here is a link to its documentation.
    http://codex.wordpress.org/Function_Reference/set_post_thumbnail_size

    Finally you might need to use the regenerate plugin to have the newer image thumbnails created.

    http://wordpress.org/plugins/regenerate-thumbnails/

    Hope it helps :slight_smile:

  • Mindblaze
    • The Incredible Code Injector

    Just to make it clear, Modifying your code to the following will allow you to change your post image size:

    if( function_exists( 'add_theme_support' ) ) {
    
    	add_theme_support( 'post-thumbnails' );
    	add_theme_support( 'homepostthumbnails' );
    	set_post_thumbnail_size( 100, 90, true );
    
      add_image_size( 'thumbone', 55, 45, true );
      add_image_size( 'thumbtwo', 418, 215, true );
    }

    Will make your post thumbnail size 100px by 90px.

    In case you have different themes in your multisite, you will either need to make it a plugin, or use mu-plugins.

  • Jack Kitterhing
    • Code Norris

    Hi there @bengkuluekspress

    I hope you are well today. Looks like @Mindblaze has given you some fantastic advice there.

    Please let me know if you need any further assistance with this, I'm here to help :slight_smile:

    Thank you both for being WPMU DEV members and have a great weekend!

    Kind Regards
    Jack.

  • bengkuluekspress
    • WPMU DEV Initiate

    hi, i have changed my code in functions.php main site theme and blog theme. blog theme i use Twenty Twelve and main site i use custom theme...but in my front page post thumbnail keep 150px X 150px

    i'm not found wher code width 150px or height 150px
    in my front page mainsite i call thumbnail like

    <?php if(get_option('thumbok')!="no"):?>  <?php if( get_the_post_thumbnail() ) { ?>
                <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(''); ?></a>
                 <?php } else { ?>
               <a href="<?php the_permalink(); ?>">  <img src="<?php bloginfo('template_directory'); ?>/images/noimg.png" style="width:146px; height:85px;" /> </a><?php } ?>
               <?php endif?>

    so, what can i do for this?

  • bengkuluekspress
    • WPMU DEV Initiate

    custom theme jack, in my functions.php from my blog theme i can resize picture. we can see it in wp-upload/site/.....

    i can display my thumbnail in my frontpage theme (main site) from blogs with change setting -> media ->Thumbnail size an check list the "thumbnail to exact dimensions (normally thumbnails are proportional)"

    but i want some categories thumbnail different size in my front page. can i?
    besides that, if i create new posting with main site and upload picture, and i can call thumbnail like this code

    add_image_size( 'thumbme', 216, 125, true );

    i just call thumbme in index.php (main site) and the thumbnail is display.

    index.php code like

    <?php if( get_the_post_thumbnail() ) { ?>
                <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbme'); ?></a>
                 <?php } else { ?>
               <a href="<?php the_permalink(); ?>">  <img src="<?php bloginfo('template_directory'); ?>/images/noimg.png" style="width:216px; height:125px;" /> </a><?php } ?>

    so, how to display images from the blog? can i call like "thumbme"
    mybe like bp-social theme :smiley:
    thank's

  • Jack Kitterhing
    • Code Norris

    Hi there @bengkuluekspress

    I hope you are well today, ah, you want to call a different size only for a certain category or page?

    The code like they have on that link you posted, you don't have that it looks like, have you seen this here https://premium.wpmudev.org/blog/daily-tip-how-to-change-the-post-thumbnail-size-in-a-wordpress-theme/ ?

    Could I get some details please to take a look at your whole code for this, so I can see why it not be working for you :slight_smile:

    - In the subject field add "Attn: Jack Kitterhing"
    - Link back to this thread
    - Include admin/network access
    - Include FTP
    - Include any relevant URLS for your site

    On the contact form, select "I have a different question", this ensures it comes through and gets assigned to me.

    https://premium.wpmudev.org/contact/

    Thank you!

    Kind Regards
    Jack.

  • Jack Kitterhing
    • Code Norris

    Hi there @bengkuluekspress

    I hope you are well today.

    I have just replied to your email as I wasn't able to download the zip.

    No problem if your site is on localhost, I shouldn't need details, I should only need to see the code which is within the zip :slight_smile:

    Thank you!

    Kind Regards
    Jack.

  • bengkuluekspress
    • WPMU DEV Initiate

    function.php in line 824

    if( function_exists( 'add_theme_support' ) ) {
    
    	add_theme_support( 'post-thumbnails' );
    	add_theme_support( 'homepostthumbnails' ); 
    
      add_image_size( 'singlegalthumb', 55, 45, true );
      add_image_size( 'featbigimg', 418, 215, true );
      add_image_size( 'featgalimg', 216, 125, true );
      add_image_size( 'featgalsliderimg', 298, 295, true );
      add_image_size( 'colorcontentblock1', 146, 85, true );
      add_image_size( 'colorcontentblock2', 384, 217, true );
      add_image_size( 'colorcontentblock3', 173, 137, true );
      add_image_size( 'colorcontentblock3a', 173, 75, true );
      add_image_size( 'colorcontentblock4', 205, 120, true );
      add_image_size( 'colorcontentblock5', 220, 288, true );
      add_image_size( 'colorcontentblock6', 220, 146, true );
      add_image_size( 'colorcontentblock8', 320, 190, true );
      add_image_size( 'colorcontentblock9', 320, 190, true );
      add_image_size( 'colorcontentblock10', 210, 146, true );
      add_image_size( 'relatedimg', 150, 125, true );
      add_image_size( 'tujuhlima', 75, 75, true );
      add_image_size( 'seratus', 100, 100, true );
      add_image_size( 'singlegalthumb', 55, 45, true );   }

    index.php in line 15 (display image thumbnail)

    <?php if(get_option('thumbok')!="no"):?>  <?php if( get_the_post_thumbnail() ) { ?>
                <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('featgalimg'); ?></a>
                 <?php } else { ?>
               <a href="<?php the_permalink(); ?>">  <img src="<?php bloginfo('template_directory'); ?>/images/noimg.png" style="width:216px; height:125px;" /> </a><?php } ?>
               <?php endif?>

    thumbnail can't display with size 216px X 125px from blog/subdomain multisite
    if i post from mainsite/maindomain thumbnail can display with fetgalimg
    that my code jack...thx

  • Jack Kitterhing
    • Code Norris

    Hi there @bengkuluekspress

    I hope you are well today sorry for the delay on this.

    I have just been discussing this with one of our lead developers and we both agree that your current code should work, but it won't change the thumbnails already generated for that you will need to use a plugin like this http://wordpress.org/plugins/regenerate-thumbnails/

    Then, you must make sure the code is in all themes for all sites on your network it can't just be one of the themes or one of the sites.
    You should have this in all of your theme's functions.php in your network.

    You must have the add_image_size calls on every site where you intends to use the function.

    Or you could put that in a mu-plugin and it would also work there, that may even be better :slight_smile:

    Thank you! Sorry again about the delay.

    Kind Regards
    Jack.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.