• ibblogosphere

    (@ibblogosphere)


    Hi, firstly thanks to anyone who can help me with this. I’m a php thicko.

    The url for the blog (in development) is: https://testblogs.ibo.org

    My problem:
    I need to be able to pull in posts from other blogs (shown in the right hand column) and promote them to show on homepage in ‘FEATURED BLOG POST’, ‘MORE FEATURED BLOG POSTS’ and ‘IN AND AROUND THE IB’
    Each of these sections is basically a category displaying posts that are assigned the same ID.
    Would it be possible to show posts from other blogs on the homepage e.g. DP blog?
    I have attempted to find ways of doing this but cannot find a solution. The main index blog displays homepage articles based on the category ID i.e.
    ‘FEATURED BLOG POST’ – ID=3
    ‘MORE FEATURED BLOG POSTS’ – ID=4
    ‘IN AND AROUND THE IB’ – ID=5

    I have spoken to someone who kind of gave me a solution but I need to know how to do the following:

    Use the ‘Custom Field’ option that already exists in posts to add a customised ‘key->value’ (something like key:promote_to_front, value: true). This could then be added quickly and easily to posts that you wanted to appear on the main blog. The value is stored in the db and can be searched for using “SELECT [postid] FROM [tablename] where metakey = [key] and value = [value]”.

    Then, select the fields that you need from the most recent post from the returned list of posts, eg: title, content (truncated), and permalink, and change your ‘Featured posts’ category to be a place-holder outputting these values from the selected post.

    Here is my code:

    <?php get_header(); ?>
    <div id="content">
    
      <div class="feature clearfloat" id="lead">
    
       <?php
    // this is where the Lead Story module begins
       query_posts('showposts=1&cat=3'); ?>
        <?php while (have_posts()) : the_post(); ?>
        <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('template_url'); ?>/images/<?php
    // this is where the Lead Story image gets printed
    	$values = get_post_custom_values("Image"); echo $values[0]; ?>" alt="" id="leadpic" /></a>
        <h3>
    	<?php
    	// this is where the name of the Lead Story category gets printed
    	wp_list_categories('include=3&title_li=&style=none'); ?></h3>
        <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>" class="title">
        <?php
    // this is where the title of the Lead Story gets printed
    	the_title(); ?>
        </a>
        <?php
    // this is where the excerpt of the Lead Story gets printed
    	the_excerpt(); ?>
        {<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">More&raquo;</a>}
        <?php endwhile; ?>
      </div><!--END FEATURE-->
    
      <div id="leftcol">
        <?php
    // this is where the Features module begins
    	query_posts('showposts=5&cat=4'); ?>
        <h3><?php
    	// this is where the name of the Features category gets printed
    	wp_list_categories('include=4&title_li=&style=none'); ?></h3>
        <?php while (have_posts()) : the_post(); ?>
        <div class="feature"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('template_url'); ?>/images/<?php
    // this is where the custom field prints images for each Feature
    	$values = get_post_custom_values("Image"); echo $values[0]; ?>" alt="" /></a><a href="<?php the_permalink() ?>" rel="bookmark" class="title">
          <?php
    // this is where title of the Feature gets printed
    	  the_title(); ?>&raquo;</a></div>
        <?php endwhile; ?>
      </div><!--END LEFTCOL-->
    
      <div id="rightcol">
    
        <?php
    // this is where you enter the IDs of which categories you want to display
    $display_categories = array(5);
    foreach ($display_categories as $category) { ?>
        <div class="clearfloat">
          <?php query_posts("showposts=5&cat=5");
    	    $wp_query->is_category = false;
    		$wp_query->is_archive = false;
    		$wp_query->is_home = true;
    		 ?>
    
          <h3><a href="<?php echo get_category_link($category);?>"><?php
    	// this is where the name of each category gets printed
    	  single_cat_title(); ?></a></h3>
          <?php while (have_posts()) : the_post(); ?>
          <?php
    // this grabs the image filename
    	$values = get_post_custom_values("Image");
    // this checks to see if an image file exists
    	if (isset($values[0])) {
    ?>
          <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php bloginfo('template_url'); ?>/images/<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>" alt="" /></a>
          <?php } ?>
          <a href="<?php the_permalink() ?>" rel="bookmark" class="title"><?php
    // this is where title of the article gets printed
    	  the_title(); ?>&raquo;</a>
          <?php the_excerpt(); ?>
    
          <?php endwhile; ?>
        </div>
        <?php } ?>
      </div><!--END RIGHTCOL-->
    
    </div><!--END CONTENT-->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
  • The topic ‘Pulling in posts from other blogs into a Mimbo themed blog’ is closed to new replies.