• Hi there,

    I’m trying to display the latest three News posts on the following static page (www.rjt-online.com/wp).

    The code I have posted below has worked in that sense, but it isn’t displaying the date. I would like each post to display “Posted on Monday, July 12th, 2010 by admin” (obviously with the correct date for each post) underneath each title.

    Any help would be greatly appreciated.

    <div id="container">
    <span id="archives">
    <h3 class="widget-title-left">LATEST NEWS //</h3>
    			</span>
    			<div id="content" role="main">
    
    <?php 
    
    query_posts('posts_per_page=3&cat=23');
    if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    
    				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    					<?php if ( is_front_page() ) { ?>
    						<h2 class="entry-title"><?php the_title(); ?></h2>
    					<?php } else { ?>
    						<h1 class="entry-title"><?php the_title(); ?></h1>
    					<?php } ?>				
    
    					<div class="entry-content">
    						<?php the_content(); ?>
    						<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    						<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
    					</div><!-- .entry-content -->
    				</div><!-- #post-## -->
    
    				<?php comments_template( '', true ); ?>
    
    <?php endwhile; ?>
    
    			</div><!-- #content -->
    </div>
Viewing 3 replies - 1 through 3 (of 3 total)
  • <div id="container">
    <span id="archives">
    <h3 class="widget-title-left">LATEST NEWS //</h3>
    			</span>
    			<div id="content" role="main">
    
    <?php 
    
    query_posts('posts_per_page=3&cat=23');
    if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    
    				<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    					<?php if ( is_front_page() ) { ?>
    						<h2 class="entry-title"><?php the_title(); ?></h2>
    					<?php } else { ?>
    						<h1 class="entry-title"><?php the_title(); ?></h1>
    					<?php } ?>				
    
    					<div class="entry-content"><div class="postdate">Posted by <strong><?php the_author() ?></strong> on  <?php the_time('F jS, Y') ?> <?php if (current_user_can('edit_post', $post->ID)) { ?>
    						<?php the_content(); ?>
    						<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
    						<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="edit-link">', '</span>' ); ?>
    					</div><!-- .entry-content -->
    				</div><!-- #post-## -->
    
    				<?php comments_template( '', true ); ?>
    
    <?php endwhile; ?>
    
    			</div><!-- #content -->
    </div>

    Paste the following code in singles.php file. I have edited the code which will show the Posted by and Posted on. If the code does not work, please feel free to contact me

    Thread Starter chrischickenwire

    (@chrischickenwire)

    I assume you meant to post that in page_home.php which I am using as the Home page template?

    Its throwing the following error when I do that:

    Parse error: syntax error, unexpected T_ENDWHILE in /home/rjtonlin/public_html/wp/wp-content/themes/twentyten/page_home.php on line 37

    I also tried pasting it in singles.php but that didn’t work either.

    Thread Starter chrischickenwire

    (@chrischickenwire)

    Any more help with this would be great?

    I’d simply like to display the “posted date” underneath the posts title

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Displaying date of post on static page issue?’ is closed to new replies.