• Resolved carlos-campo

    (@carlos-campo)


    I am developing a theme with posts in the right sidebar under category ‘SIDEBAR’. The sidebar posts show an image and a short desription followed by the <!–more–> insert.
    The main posts are under category ‘CENTRE’ and also use the <!–more–> insert.
    Unfortunately If I click to read a centre post, or sidebar post (single.php) the sidebar posts now display the complete contents.
    How can I stop this from happening

    main pages:
    <?php query_posts(‘category_name=centre’);
    php if (have_posts()) : php while (have_posts()) : the_post(); ?>

    stuff here

    <?php endforeach; else: ?>
    <p><?php _e(‘Sorry, no posts matched your criteria.’); ?></p>
    <?php endif; ?>

    Sidebar:
    <?php query_posts(‘category_name=sidebar’);
    php if (have_posts()) : php while (have_posts()) : the_post(); ?>

    stuff here

    <?php endforeach; else: ?>
    <p><?php _e(‘Sorry, no posts matched your criteria.’); ?></p>
    <?php endif; ?>

    Thanx

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi

    I worked this out the other day

    using the more tag on a page or in the sidebar

    <?php
    global $more;
    $sidebar = new WP_Query();
    $sidebar->query('category_name=sidebar');
    while ($sidebar->have_posts()) : $sidebar->the_post();
       $more = false;   // set $more to false to only get the first part of the post ?>
       <p><?php the_content('Read the rest...'); ?></p>
    <?php endwhile;
    $more = true;   // restore default $more behavior
    ?>

    Thread Starter carlos-campo

    (@carlos-campo)

    Hey stvwlf,
    thanks for the prompt reply and thanks heaps the code above which works just great. I believe WP can do anything if one has the support of this forum.
    Again.. thanks
    Carlos

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘sidebar posts’ is closed to new replies.