WordPress.org

Ready to get started?Download WordPress

Forums

WordPress MU Sitewide Tags Pages
[resolved] Several sizes for Post Thumbnails? (7 posts)

  1. svisie
    Member
    Posted 1 year ago #

    I think the Sitewide tags plugin is a great and useful plugin. I'm now working on a site that isn't online yet, and it's going great, partly because of this plugin.

    At the moment I'm trying to find out how to get several sizes of post thumbnails.

    All subblogs on my website automatically generate thumnails in several sites by adding a code to the functions.php from the themes they use.

    functions.php

    add_theme_support( 'post-thumbnails' );
    the_post_thumbnail( array(521,246) );
    set_post_thumbnail_size( 521, 246 );
    add_image_size( 'meest-recent-voorpagina', 520, 250, true );
    add_image_size( 'minder-recent-voorpagina', 235, 110, true );
    add_image_size( 'bovenbalk', 70, 50, true );
    add_image_size( 'zijbalk', 100, 60, true );
    add_image_size( 'single', 225, 250, true );

    In theme the featured images are displayed with the normal code like

    <?php  echo '<a href="', get_permalink(), '">';
    if (has_post_thumbnail()) {
        the_post_thumbnail('meest-recent-voorpagina');
    }
    else {
        echo
            '<img src="',
            get_bloginfo('template_directory'), '/images/noimage.png',
            '" width="520" height="250" alt="logo" />';
    }
    echo '</a>';  ?>

    or

    <?php  echo '<a href="', get_permalink(), '">';
    if (has_post_thumbnail()) {
        the_post_thumbnail('minder-recent-voorpagina');
    }
    else {
        echo
            '<img src="',
            get_bloginfo('template_directory'), '/images/noimage.png',
            '" width="235" height="110" alt=logo" />';
    }
    echo '</a>';  ?>

    The theme of the main site uses all this sizes of thumnails (depending on the position of the post). I'm looking for a way to integrate all this sizes to the post data of the post that is copied by the Sitewide Tags plugin. I noticed it included the 'thumbnail_html' with the default 150x150 size. Are there any tips and tricks to include the other sizes?

    http://wordpress.org/extend/plugins/wordpress-mu-sitewide-tags/

  2. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 1 year ago #

    Hook into save_post before SWT and add the other size thumbnail html to your post meta. Then add those fields to the list of post meta that SWT copies.

  3. svisie
    Member
    Posted 1 year ago #

    It worked, thanks :) All sizes are now included in the post meta.
    Now I only need to change the theme, so it gets the right data from the posts.

  4. locworks
    Member
    Posted 1 year ago #

    @svisie: Would you mnind sharing the code you used for the hook?

  5. Atlasfire
    Member
    Posted 1 year ago #

    Hi,

    I am in the same position of having a number of thumbnail sizes used on my main blog and need the SWT plugin to pull those image sizes across from the subsites. I am sorry if I should have been able to figure out how to do this from the information supplied above, but I am learning as I go and have become thoroughly stuck at this point!

    "Hook into save_post before SWT and add the other size thumbnail html to your post meta. Then add those fields to the list of post meta that SWT copies. "

    If anyone is available to walk me through this process it would be much appreciated!

    Thanks!

  6. mintyquinty
    Member
    Posted 1 year ago #

    I've been knocking my head against this wall for awhile now, too. And I could not decipher the cryptic message, "Hook into save_post before SWT and add the other size thumbnail html to your post meta. Then add those fields to the list of post meta that SWT copies," either.

    It turns out, though, that I didn't even need to get so esoteric: I think that the "has_post_thumbnail()" function pretty much fails for all these kinds of custom post type posts in the "target" site when using SWT, at least for my 3.5.1 implementation. So, depending on the extent to which you created new custom thumbnail sizes, you may not have ANY thumbnails, at least from the SWT point-of-view, regardless of the postmeta fields you fiddle with.

    All I did to make my custom thumbnail sizes appear within my custom post types when using SWT was to comment out that "if ( has_post_thumbnail() ):" line inside my content list .php file. (For me, this was content-home.php, as I had customized my homepage. Out-of-the-box, though, I think the pertinent file is just "content.php." But it's been awhile since I did anything by-the-book in WPMU :)

    After that, my thumbnails appeared just as I expected, regardless of the size I specified -- they were all there. Dunno if that helps anyone else, but... there you go. For me, all that postmeta stuff was just so much noise.

  7. terjunbebas
    Member
    Posted 1 year ago #

    share the code or sample plisss

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.