• Resolved lola rennt

    (@laurenserge)


    Dear WordPressers,

    I have a very simple request. It is exactly the same question posed in this thread, but it remains unanswered. It is probably a novice mistake – but any insight is welcome!

    Basically I want my sidebar to display an index archive of posts (as links). I managed to do this by copying the code from the archive page to the sidebar. Now the problem is that when I click on a post it displays the post on a single.php page correctly but the sidebar also displays that single post.
    I would want the sidebar to stay static, so it should keep on displaying the archive index as a whole. Additionally I want the post which is active to be highlighted in the sidebar – that would be awesomeness ofcourse : )!

    But first things first. Here is my code, what am I doing wrong?

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Thanks so much for your initial help!

Viewing 1 replies (of 1 total)
  • Thread Starter lola rennt

    (@laurenserge)

    I managed to solve the problem with the template tag get_posts which succesfully renders an archive list of all posts. And it is customizable with simple tags. Perfect!
    Here is the code:

    <?php
    $args = array( 'numberposts' => 100, 'orderby'=> 'post_date');
    $postslist = get_posts( $args );
    foreach ($postslist as $post) :  setup_postdata($post); ?>
    	<div>
    		<?php the_date(); ?>
    		<br />
    		<?php the_title(); ?>
    		<?php the_excerpt(); ?>
    		<?php the_category(' '); ?>
    	</div>
    <?php endforeach; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Sidebar as a static archive index’ is closed to new replies.