• Hi there,
    I would like to be able to display the 3 latest posts on an additional page in this format:
    24/07/2004: Latest news title here
    22/07/2004: Latest news title here
    19/07/2004: Latest news title here
    Could someone possibly tell me how I would do this please?
    Many many thanks
    Karl

Viewing 15 replies - 1 through 15 (of 21 total)
  • i would love to do this as well…

    I use the get_recent_posts function for something similar to this.
    It is a function you put in your my-hacks.php file.
    https://wiki.www.ads-software.com/Recent%20Posts

    Thread Starter karlb

    (@karlb)

    Thanks for that ??
    How would I actually append the date to the recent posts also like I mentioned?
    Many thanks
    Karl

    in that function above, ask for the date in mysql:
    …SELECT ID, post_title, DATE_FORMAT(post_date,’%d/%m/%Y’) as postdate FROM …
    under “foreach ($posts as $post) {“
    add
    $post_date = $post->postdate;
    Then change your $output line to include that $post_date variable in the link:
    ….title=”Permanent Link: ‘ . $post_title . ‘”>’ . $post_date . ” – ” . $post_title . ‘ …..

    Oh yeah, if you want to change the date format like 07/27/2004 to be like July 7, 2004, just use the date/time stuff from the MySQL site:
    https://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html
    so change %d %m, etc….
    -TT (sorry, haven’t registered here yet, but was looking for this function)

    Hi TT,
    I have been looking for something like this too.
    I am not that PHP and mySQL savvy.
    Could you tell me how this would be implemented?
    Jim

    Thread Starter karlb

    (@karlb)

    That is great ??
    Thanks a zillion ??
    Karl

    I get this error: Fatal error: Call to undefined function: get_recent_posts() in /web/www/frac/users/kristianp/index.php on line 4 when I use that code…I am using version 1.2..
    What can I do to fix that? Soon the site with the blogs will be on news.php instead of index.php

    Don’t know your particular situation, but that would mean “call to undefined function” ?? which means get_recent_posts is not being included. Did you put it in “myhacks.php” and did you turn on myhacks legacy support in the Admin section of WP?

    In version 1.2 you should be able to do the plugin which I did.. What is the difference between my-hacks.php and the plugin? Should I put it in my-hacks.php?

    I did not know there was a plugin – the link I followed above was to a function hack to be inserted in “myhacks.php”
    If there is a plugin (certainly not saying there isn’t) and it is activated you would not be getting that particular error within WP.

    I used the link to the recent posts one here in this thread…
    I’d think most of the hacks for 1.0.2 can be changed to the plugin thingy that comes with 1.2.
    What I meant with the plugin, was to just take the code, put it in its own file, upload it in the plugins folder and activate it..

    ok then.. thank you for your help.. i will try that..

    I tried to put it in my-hacks.php, enable it in /options-misc.php – Use legacy my-hacks.php file support, but it still are giving me this error:
    Fatal error: Call to undefined function: get_recent_posts() in /web/www/frac/users/kristianp/index.php on line 7
    What am I doing wrong?

    Anyone? I really need this to work.. The site won’t be opened before….

Viewing 15 replies - 1 through 15 (of 21 total)
  • The topic ‘Post titles on an additional page – How?’ is closed to new replies.