WordPress.org

Ready to get started?Download WordPress

Forums

PHP question (7 posts)

  1. basketball
    Member
    Posted 9 years ago #

    Can someone help me get this line of php code working:

    function get_recent_posts($no_posts = 5, $before = '<li>', $after = '</li><small>Posted on <?php the_time('F jS, Y') ?> at <?php the_time('g:i a') ?>&nbsp; | Comments: <?php comments_popup_link(__('(0)'), __('(1)'), __('(%)')); ?></small>', $show_pass_post = false, $skip_posts = 0) {

    Just that part where it says &after = ' ' Everytime I add that php_the_time part it gives me the following error;

    Parse error: parse error, unexpected T_STRING, expecting ')' in /home/bball2/public_html/site/my-hacks.php on line 2

  2. basketball
    Member
    Posted 9 years ago #

    Anyone?

  3. Beel
    Member
    Posted 9 years ago #

    Yeah, two things - can't have <?php ?> in the function for one. For the other, don't thing the_time would work here anyway.

  4. basketball
    Member
    Posted 9 years ago #

    Dang, that's too bad. Then does anyone have any ideas where I can have a list a list of the last 5 or 6 posts along with it's dates and number of comments and the title of course.

  5. Beel
    Member
    Posted 9 years ago #

    If you are using the old my-hacks function I think you are using, you can modify the function. As I recall it pulled the id and post_title out of the database. You will have to add post_date and use maybe:
    $blah = $post->post_date;
    and then manipulate it however you want.

  6. basketball
    Member
    Posted 9 years ago #

    Thanks for the help Beel but I got lucky and stumbled onto what is slowly becoming one of my favourite WP plugins.

    http://www.coffee2code.com/archives/2004/08/27/plugin-customizable-post-listings/

    It does EVERYTHING!

  7. Beel
    Member
    Posted 9 years ago #

    Good. I also happen to use Scott's plugin for an upcoming events page for a site I am working on:
    http://www.billhayes.us/~stjohns/parish-activities

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.