• 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.