Title: Adding date pull to functions.php
Last modified: August 19, 2016

---

# Adding date pull to functions.php

 *  [nlesti](https://wordpress.org/support/users/nlesti/)
 * (@nlesti)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/adding-date-pull-to-functionsphp/)
 * Hi Very new to WordPress and am muddling my way through.
 * I have my functions.php file set up to pull posts from a category and then am
   using the excerpt field in the wordpress backend of the post itself to enter 
   in the title of the post itself. Long story but needed to do it this way.
 * So my functions.php file has this:
 * function show_posts_from_category( $numberofposts = 10, $category_name = ‘News’){
   
   $post_cat_id = get_cat_id($category_name); $posts = get_posts(“numberposts=”.
   $numberofposts.”&category=”.$post_cat_id); foreach ($posts as $post) { echo ‘
    - <span>’.$post->post_excerpt.'</span>’;
       echo ‘ID).'”>Read More
    - ‘;
       }
    - Then in my static home.php file/sidebar area I am doing this:
    -  <?php show_posts_from_category(10, ‘News’); ?>
    - This displays the title of the post (as filled in the excerpt field in the
      backend) but I would also like the sidebar to show the date of the post as
      well.
    - So I believe I need to add (<?php the_time(‘F j, Y’); ?>) to the above functions.
      php code file so it will display under the post name, right before it shows
      the Read More link.
    - This seems so simple but I keep blowing it up. Any chance someone could steer
      me on how to add this to my functions.php file?
    - Any help is appreciated!

Viewing 1 replies (of 1 total)

 *  Thread Starter [nlesti](https://wordpress.org/support/users/nlesti/)
 * (@nlesti)
 * [16 years, 8 months ago](https://wordpress.org/support/topic/adding-date-pull-to-functionsphp/#post-1216808)
 * Sorry, that echo in the functions.php is displaying incorrectly in the above 
   post. I am hoping this will display that code correctly, but if not, I have the
   Read More Link functioning correctly already.
 * echo ‘
    - <span>’.$post->post_excerpt.'</span>’;
       echo ‘['.get_permalink($post->ID).'>Read More](https://wordpress.org/support/topic/adding-date-pull-to-functionsphp/code?output_format=md)
    - ‘;

Viewing 1 replies (of 1 total)

The topic ‘Adding date pull to functions.php’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [nlesti](https://wordpress.org/support/users/nlesti/)
 * Last activity: [16 years, 8 months ago](https://wordpress.org/support/topic/adding-date-pull-to-functionsphp/#post-1216808)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
