• Resolved noelgreen

    (@noelgreen)


    I have a site that I want to show the excerpt from the recent post in 2 categories in the sidebar. It works on the main page, but other pages it comes up blank.

    Here’s the code…

    <?php query_posts('cat=4,5'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    <?php the_excerpt(); ?>
    <?php endwhile; endif; ?>

    Suggestions, ideas?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter noelgreen

    (@noelgreen)

    I see a LOT of posts on here that are close to solving this, but nothing I’ve found yet solves it.

    Thread Starter noelgreen

    (@noelgreen)

    This almost does it.

    <?php $postlist = get_posts('category=4');
    foreach ($postlist as $post) :?><a href="<?php the_permalink() ?>" rel="bookmark" title="Buy this..."><?php post_image('default_image', 'use_thumb=1'); ?></a><?php endforeach; ?>

    But the problem is I’m actually not just trying to post the excerpt… I’m using the Post Image plug-in and that’s not allowing me to use it there.

    So… any suggestions on this?

    Thread Starter noelgreen

    (@noelgreen)

    Any help?
    Pretty please with code on top?

    Thread Starter noelgreen

    (@noelgreen)

    Got it!!!

    This code works:

    <?php query_posts('cat=4'); ?>
    <?php $posts = get_posts('category=4&offset=0');
    foreach ($posts as $post) : start_wp(); ?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Buy this..."><?php post_image('default_image', 'use_thumb=1'); ?></a>
    <?php endforeach; ?>

    I found it here.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Show Categories on Sidebar’ is closed to new replies.