Title: Switching between posts in wordpress
Last modified: August 21, 2016

---

# Switching between posts in wordpress

 *  [Michael](https://wordpress.org/support/users/kcmello/)
 * (@kcmello)
 * [12 years ago](https://wordpress.org/support/topic/switching-between-posts-in-wordpress/)
 * Greetings! I have created a sidebar.php-file with the code;
 *     ```
       <section class="sidomeny"><p class="Senastenytt2"><?php get_search_form();?></p></section><!--Slut på sidomeny-->
   
       <div id="nyhet3">
   
           <?php
   
                   query_posts('category = all');
   
           if (have_posts()) :
   
              while (have_posts()) : ?>
   
                    <?php the_post(); ?>
   
                <p class="datum2"><?php the_time('Y-m-d'); ?></p>
                <p class="Nyhetsrubrik3"><a>" ><?php the_title(); ?></a></p>
   
            <?php the_excerpt(); ?>
                     <p class="textnyhet2">
   
          </p>
   
             <?php endwhile;
             endif;
           ?>
       ```
   
 * _[Moderator Note: Please post code & markup between backticks or use the code
   button. Your posted code may now have been permanently damaged by the forum’s
   parser.]_
 * And now I would like to add the function that if you press the sidebar news section,
   the “textnyhet2” section will get updated with the news you clicked on. That 
   is how it’s working now.
 * But the problem is that the sidebar vanished whenever you click on one of those“
   latest news” links. So what I need help with is to edit the sidebar.php-file 
   so the “latest news” function with links is still there so you don’t have to 
   go back one page whenever you would like to read about another post.
 * Im not sure how to do this. If it’s php involved or if you can do it by simple
   visiting the posts/pages section in wordpress.
 * Would be grateful if anyone could help me. If I have forgotten any necassary 
   information please tell me and I will the post.
 * Thanks!

The topic ‘Switching between posts in wordpress’ is closed to new replies.

## Tags

 * [sidebar](https://wordpress.org/support/topic-tag/sidebar/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [Michael](https://wordpress.org/support/users/kcmello/)
 * Last activity: [12 years ago](https://wordpress.org/support/topic/switching-between-posts-in-wordpress/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
