WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Date won't display on same-day posts (2 posts)

  1. Snakeye
    Member
    Posted 8 years ago #

    I'm trying to get the date to display on multiple posts on the same day. I haven't been able to find much help on PHP (as I think that's where my problem lies). Right now, if I have 2 posts on the same day, I get the second post having a blank date. I've used the Travelogue theme as a base and modified it from there. Here is the current code in index.php for the date stuff:

    <div class="post">
       <div class="post_cal">
       <?php $postraw = the_date('D, j, M, y', '', '',FALSE);
        $postdate = explode(', ', $postraw);?>
       <div class="dayname"><?php echo $postdate[0]; ?></div>
       <div class="daynum"><?php echo $postdate[1]; ?></div>
       <div class="month"><?php echo $postdate[2]; ?> '
       <?php echo $postdate[3]; ?></div>
       <div class="year">

    Is there anyway I can mod this to post the date on all posts?

  2. Snakeye
    Member
    Posted 8 years ago #

    I got it now. I R<sup>2</sup> it with this code:

    <?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div class="post">
    				<div class="post_cal">
    					<?php
    						$postraw = the_date('D, j, M, y', '', '', FALSE);
    						if ($postraw != '') {
    							$postdate = explode(', ', $postraw);
    						} ?>
    					<div class="dayname"><?php echo $postdate[0]; ?></div>
    					<div class="daynum"><?php echo $postdate[1]; ?></div>
    						<div class="month"><?php echo $postdate[2]; ?> '<?php echo $postdate[3]; ?></div>
    						<div class="year">

Topic Closed

This topic has been closed to new replies.

About this Topic