• Resolved fotofio

    (@fotofio)


    I am having dificulty on one project with the following code. The end result is the proper excerpt and read more links but the title for each of the two posts comes from yet another post in another category.

    Who can figure this one out?

    <div class="sidebar_box2" id="articlesTab">	<div class="mores"><p><a href="<?php next_post_link('%link', '', TRUE); ?>">More &raquo;</a></p></div>	
    
    <ul>
    <?php query_posts('category_name=fp&showposts=2'); //$do_not_duplicate = $post->ID;
    			 if (have_posts()) : while (have_posts()) : the_post();
    			 //if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts);
    			 ?>
    
    	<li>
    		<a href="<?php echo get_permalink($postid); ?>" title="<?php echo $title ?>"><?php echo $title ?></a>
    
    		<p class="text"><?php the_excerpt(); ?></p>
    		</li>
    
     <?php endwhile; endif; ?>
    
    </div>
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter fotofio

    (@fotofio)

    <div class="sidebar_box2" id="articlesTab">	<div class="mores"><p><a href="<?php next_post_link('%link', '', TRUE); ?>">More &raquo;</a></p></div>	
    
    <ul>
    <?php query_posts('category_name=fp&showposts=2'); //$do_not_duplicate = $post->ID;
    			 if (have_posts()) : while (have_posts()) : the_post();
    			 //if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts);
    			 ?>
    
    	<li>
    		<a href="<?php echo get_permalink($postid); ?>" title="<?php echo $title ?>"><?php echo $title ?></a>
    
    		<p class="text"><?php the_excerpt(); ?></p>
    		</li>
    
     <?php endwhile; endif; ?>
    
    </div>

    change $title to $post->post_title

    Thread Starter fotofio

    (@fotofio)

    Thanks buddy, that got it done. The permakink is a little funky, seems to point to a revision? Any guidance there?

    I would look into changing

    get_permalink($postid) to get_permalink($post->ID)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Specific category posts not working in sidebar’ is closed to new replies.