• Resolved seth-Prevnt

    (@seth-prevnt)


    I’m a new WP user, and I’m working on my first site for a company I’m with. In trying to clean up the design a while back, I initially spent tons of time trying to remove the author, date, and category from each post on the homepage on our blog. I was successful, but I don’t remember how I did it. Here’s our site:

    https://www.prevnt.com

    Now we’ve decided we want the date to show back up on the homepage (it currently shows on each post, but not on the homepage). How do I do this? I’ve spent so much time that it’s driving me nuts and I know it can’t be a tough solution.

    Thanks so much in advance. I really appreciate it!

Viewing 5 replies - 1 through 5 (of 5 total)
  • You need to add some code to the loop. Open index.php, then underneath <h2 class=”posttitle”>blah blah</h2> put this:
    <p class="date"><?php the_date()></p>

    Thread Starter seth-Prevnt

    (@seth-prevnt)

    Thanks a ton for your help. I just tried that and when I added it in, my entire site wouldn’t load. Here is part of the code from index.php. Is there something in there that I need to remove? We don’t want the category or author to show on the homepage, JUST the date.

    <h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'cc' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    
    <p class="date"><?php the_time('F j, Y') ?> <em><?php _e( '', 'cc' ) ?> <?php if(defined('BP_VERSION')){  printf( __( ' by %s', 'cc' ), bp_core_get_userlink( $post->post_author ) );}?></em></p>
    
    							<div class="entry">
    								<?php do_action('blog_post_entry')?>
    							</div>
    							<?php $tags = get_the_tags(); if($tags)	{  ?>
    								<p class="postmetadata"><span class="tags"><?php the_tags( __( 'Tags: ', 'cc' ), ', ', '<br />'); ?></span> <span class="comments"></span></p>
    							<?php } else {?>
    								<p class="postmetadata"><span class="comments"></p>
    							<?php } ?>
    						</div>
    
    					</div>
    
    					<?php do_action( 'bp_after_blog_post' ) ?>
    
    				<?php endwhile; ?>
    
    				<div class="navigation">
    
    					<div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'cc' ) ) ?></div>
    					<div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'cc' ) ) ?></div>
    
    				</div>
    
    			<?php else : ?>
    
    				<h2 class="center"><?php _e( 'Not Found', 'cc' ) ?></h2>
    				<p class="center"><?php _e( 'Sorry, but you are looking for something that isn\'t here.', 'cc' ) ?></p>
    
    				<?php locate_template( array( 'searchform.php' ), true ) ?>
    
    			<?php endif; ?>
    		</div>
    
    		<?php do_action( 'bp_after_blog_home' ) ?>
    
    		</div><!-- .padder -->
    	</div><!-- #content -->
    
    <?php get_footer() ?>

    Strange, I don’t know why that would break the site. Anyway, you just need to remove the bit <?php the_time(‘F j, Y’) ?> up to the closing </p>

    Like this:

    <h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'cc' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    
    <p class="date"><?php the_time('F j, Y') ?></p>
    
    							<div class="entry">
    								<?php do_action('blog_post_entry')?>
    							</div>
    							<?php $tags = get_the_tags(); if($tags)	{  ?>
    								<p class="postmetadata"><span class="tags"><?php the_tags( __( 'Tags: ', 'cc' ), ', ', '<br />'); ?></span> <span class="comments"></span></p>
    							<?php } else {?>
    								<p class="postmetadata"><span class="comments"></p>
    							<?php } ?>
    						</div>
    
    					</div>
    
    					<?php do_action( 'bp_after_blog_post' ) ?>
    
    				<?php endwhile; ?>
    
    				<div class="navigation">
    
    					<div class="alignleft"><?php next_posts_link( __( '&larr; Previous Entries', 'cc' ) ) ?></div>
    					<div class="alignright"><?php previous_posts_link( __( 'Next Entries &rarr;', 'cc' ) ) ?></div>
    
    				</div>
    
    			<?php else : ?>
    
    				<h2 class="center"><?php _e( 'Not Found', 'cc' ) ?></h2>
    				<p class="center"><?php _e( 'Sorry, but you are looking for something that isn\'t here.', 'cc' ) ?></p>
    
    				<?php locate_template( array( 'searchform.php' ), true ) ?>
    
    			<?php endif; ?>
    		</div>
    
    		<?php do_action( 'bp_after_blog_home' ) ?>
    
    		</div><!-- .padder -->
    	</div><!-- #content -->
    
    <?php get_footer() ?>

    under theme-settings / general / default-homepage you have the options to hide the author and date and more.

    Thread Starter seth-Prevnt

    (@seth-prevnt)

    Got it. I actually needed to do both things suggested above. A huge thanks!

    CodeBiotics and Full Circle, I owe you both a drink.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Help with "Date Posted" on homepage’ is closed to new replies.