Displaying post titles on single news story page
-
Hi guys,
So I have my home page on my site which displays all the post titles in a list:
|———————-|
|–post title 1——–|
|–post title 2 etc—-|
|———————-|
On my single.php page -> lets say you click on post 1, I want the following layout:|—————|————————–|
|- post title 1 | POST TITLE 1————-|
|- post title 2 | “Post title one content” |
|—————|————————–|
So for the home page I have this code which displays the 5 newest titles:<?php query_posts('showposts=5'); ?> <?php if (have_posts()) : ?> <h2 id="broadcast">Broadcast.</h2> <ul id="broadcast"> <?php while (have_posts()) : the_post(); ?> <li id="broadcast"> <a href="<?php the_permalink(); ?>"><?php the_title(); ?>.</a> </li> <?php endwhile; ?> </ul> <?php endif; ?>
So I copied and pasted this into the single page, but now instead of just displaying one news story, it displays all the stories!! This is the code I have:
<div id="news_menu_left"> <?php query_posts('showposts=100'); ?> <?php if (have_posts()) : ?> <ul id="news_left_titles"> <?php while (have_posts()) : the_post(); ?> <li id="news_left_titles"> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </li> <?php endwhile; ?> </ul> <?php endif; ?> </div> <div id="news_container_single"> <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2 id="news_page_title"><?php the_title(); ?>.</h2> <div class="entry"> <div class="post_content"> <?php the_content(); ?> </div> <p class="postmetadata"> <?php the_time('l, F jS, Y') ?><?php _e(' | Share on Facebook'); ?> <br /> </p> </div> <div id="comments-template"> <?php comments_template(); ?> </div> </div> <?php endwhile; ?> <div class="navigation"> <?php posts_nav_link(); ?> </div> <?php else : ?> <div class="post"> <h2><?php _e('Not Found'); ?></h2> </div> <?php endif; ?> </div>
So from the above code, the div “new_menu_left” should display the list of 100 news titles down the left, and then the div “news_container_single” should show the one news story selected from the home page and it’s content. I know I’m nearly there,
PLEASE PLEASE CAN SOMEONE HELP!!!!
- The topic ‘Displaying post titles on single news story page’ is closed to new replies.