The MU forums have moved to WordPress.org

problem with (10 posts)

  1. croakingtoad
    Member
    Posted 14 years ago #

    Okay, so I have this code:

    <?php
    	global $blog_id;
    	if ($blog_id == 1) {
    		// switch to sitewide tags blog, #16
    		switch_to_blog(16); }
    ?>
    	<div id="topContent" class="threeCol">
          <div class="leftCol">
          	<?php
                global $blog_id;
                extract(switchBlogVars($blog_id));
    			// Main feature loop
                query_posts('cat=' . $featuredcategory . '&posts_per_page=1');
                while (have_posts()) : the_post();
            ?>
            <div id="mainImage"><?php if (has_post_thumbnail()) { the_post_thumbnail(array(381,198)); } else { ?><img src="http://foo.com/wp-content/themes/foo-home/images/roanoke-thumbs/roanoke.php" alt="Roanoke, Virginia" width="381" height="198" border="0" /><?php } ?></div>

    and the conditional if(has_post_thumbnail) is returning false even though when I click through to the individual post, the_post_thumbnail appears where I have it placed (almost identical code on the single.php page) what is going wrong here?

    Basically I'm using the site-wide tags plugin and then on blog 1 (the root blog) pulling in content from blog 16 which is the "tags" blog.

    Like I said, the thumbnail appears on the blog where the article originates, but not when I switch_to_blog(16).

    You can also view the code here with syntax highlighting: http://wordpress.pastebin.com/sCs3EQGe

    Thanks!

    @mosquitohawk

  2. croakingtoad
    Member
    Posted 14 years ago #

    sorry, but *bump*...it's been 3 days. I realize now that the subject got cut off somehow.

  3. andrea_r
    Moderator
    Posted 14 years ago #

    okay, I'm a little confused... if you're pulling in all content from the tags blog to the main blog... why not make the main blog the tags blog?

  4. croakingtoad
    Member
    Posted 14 years ago #

    I didn't know you could do that without creating a disaster. :)

  5. andrea_r
    Moderator
    Posted 14 years ago #

    Non-disastrous example site:

    http://homeschooljournal.net

  6. croakingtoad
    Member
    Posted 14 years ago #

    Okay so I have incorporated the site wide tags into my root blog and used the "old post script" to drag them all into the tags blog.

    And it's doing fine with the blogs and excerpts, however, it's not pulling in the the_post_thumbnail. After a lot of research I found a post you had participated in mentioning the Get The Image plug-in, so I installed and tried that but it isn't working, my assumption is for the same reason, the site wide tags plugin isn't pulling in the meta for the post image.

    Here's what I have in my theme:

    <?php
                global $blog_id;
                extract(switchBlogVars($blog_id));
    			// Main feature loop
                query_posts('cat=' . $category . '&posts_per_page=1');
                while (have_posts()) : the_post();
    
    			//Grab the category names, except "Featured" and output
    			foreach((get_the_category()) as $category) {
    				if ($category->cat_name != "Featured") {
    			    	$category_name .= $category->cat_name . ' ';
    				}
    			}
            ?>
            	//<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php if (function_exists('get_the_image')) { get_the_image(); } else { echo "Get The Image plugin is not working"; } ?></a>
                      <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail(array(196,264)); ?></a>

    What do I need to do to get the post image/thumbnail pulled into the tags blog?

  7. andrea_r
    Moderator
    Posted 14 years ago #

    If you have the latest SWT plugin, it has that option. (I think...)

  8. croakingtoad
    Member
    Posted 14 years ago #

    The latest version shows as being updated in December. I downloaded mine in February so I'm assuming I have the latest version, and unless I'm missing it, I don't see that an a specific option and it doesn't seem to be doing it?

  9. andrea_r
    Moderator
    Posted 14 years ago #

    I'll email ya.

  10. croakingtoad
    Member
    Posted 14 years ago #

    Okay thanks!

About this Topic

  • Started 14 years ago by croakingtoad
  • Latest reply from croakingtoad