• I am running a multisite network using Sitewide Tags plugin. I have been struggling for a couple weeks on retrieving the thumbnails with their aggregated posts.

    The main site is at dsnamerica.com/test/
    One subsite example is at dsnamerica.com/test/idaho/

    I can pull all content (title, post, links) and I have no problems changing or generating new permalinks. I do not think I have rewrite issue. I think the problem is in my theme’s code. This was a premium (cost bank) theme and I want to use it, but their response time is pretty bad at Magazine3 so I need help from you guys please.

    I want to be able to post on the main site and sub sites, but see all of those posts on the main site’s index page. Of course I also want to see all articles published in test/idaho/ in the test/idaho site, and this is working perfectly. It’s only when I try to see an article from the Idaho subsite in the main site. I can also see the posts made in the main site just fine.

    I think it’s how the theme’s code is calling the thumbnails. I’ll give you some code now since that’s what you want to see ??

    Section of theme index.php:

    <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
                     <?php if(get_option('thumbok')!="no"):?>  <?php if( has_post_thumbnail() ) { ?>
                <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('smblock3_block_l'); ?></a>
                 <?php } else { ?>
               <a href="<?php the_permalink(); ?>">  <img src="<?php bloginfo('template_directory'); ?>/img/noimg.png" alt="" style="width:284px; height:190px;" /> </a><?php } ?>
               <?php endif?>
               <?php if(get_option('thumbok')!="yes"):?>
    <?php 	$m_scrp = get_template_directory_uri() . '/includes/timthumb.php?';
                        	$m_image = '';
                        	$customfields = get_post_custom();  if (empty($customfields['image'][0])) {
    $m_image = m_theme_capture_first_image(); } else { $m_image = $customfields['image'][0]; } if (empty($m_image)) { $imgpath = $m_image_def;  	} else {
    $imgpath = $m_scrp . 'src=' . $m_image . '&w=' . 284 . '&h=' . 190 . '&zc=1'; } ?>
      <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
      <img src="<?php echo $imgpath; ?>" alt="" /> </a>
     <?php endif?>

    Yup… it uses timthumb. If you’re wondering, yes, I’ve modified the $allowedSites array to include dsnamerica.com. Also, as a test I’ve also included https://dsnamerica.com, https://dsnamerica.com/idaho as well. Right now, ALLOW_EXTERNAL is also set to TRUE, but if that makes you pee your pants a little, rest assured I will put it back to false after this problem is solved.

    In my functions file I’ve added some custom image sizes because you’ll notice that the home/landing/index page of dsnamerica.com/test offers a variety of thumbnail/featured image sized areas.

    if( function_exists( 'add_theme_support' ) ) {
    	add_theme_support( 'post-thumbnails' );	 add_theme_support( 'homepostthumbnails' );
      add_image_size( 'colorcontentblock4', 205, 120, true );
        add_image_size( 'featbigimg', 418, 215, true );
         add_image_size( 'secslider', 302, 238, true );
           add_image_size( 'content2', 150, 75, true );
                   add_image_size( 'smblock1_block_l', 200, 150, true );
         add_image_size( 'smblock1_wrap_r1', 81, 61, true );
         add_image_size( 'smblock2_block_l', 328, 181, true );
                  add_image_size( 'smblock3_block_l', 284, 190, true );
                           add_image_size( 'smblock4_block_l', 99, 66, true );
                     add_image_size( 'smblock5_block_l', 129, 67, true );
                   add_image_size( 'smblock6_block_l', 138, 104, true );
    			add_image_size( 'sidebar-thumb', 50, 50, true );
       add_image_size( 'relatedimg', 55, 55, true );    }

    I have tested a great number of possible fixes. I can’t think this through anymore. But I did have a minor success by editing the index.php of the theme to use get_the_post_thumbnail() rather than has_post_thumbnail() and it is showing the thumbnails! But… they’re all the same default size (150). Here is the code I’ve edited in the slider section (same as the code I edited in the section below the slider):

    <?php query_posts('showposts=5&cat='.of_get_option('example_select_categories').'&offset=0'); if (have_posts()) : ?>
     	<?php while (have_posts()) : the_post(); ?>
               	<div class="slide slides_threewrap">
                 <?php if(get_option('thumbok')!="no"):?>  <?php has_post_thumbnail() ?>
                <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('secslider'); ?></a>
                 <?php if(function_exists('get_post_thumbnail_id') ) { ?>
                 <?php } else { ?>
               <a href="<?php the_permalink(); ?>">  <img src="<?php bloginfo('template_directory'); ?>/img/noimg.png" alt=" " style="width:302px; height:238px;" /> </a><?php } ?>
               <?php endif?>
               <?php if(get_option('thumbok')!="yes"):?>
    
    ...blah blah, the rest is the same

    Help a brother out! Could it be SWT problem? Theme code? My code? What’s the best way to fix this little/big problem?

    Thanks all!

  • The topic ‘Correct way to get post's thumbnails?’ is closed to new replies.