WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Dunstan's time_of_day anyone? (24 posts)

  1. Vohiyaar
    Member
    Posted 10 years ago #

    Has anyone worked on setting up dunstan's time of day function into a WP plugin/hack?
    http://1976design.com/blog/archive/2004/07/23/redesign-time-presentation/
    I would've loved doing this if I knew any PHP....

  2. carthik
    Member
    Posted 10 years ago #

    You get plugins sooner than you can think them up !
    http://www.ifelse.co.uk/archives/2004/07/24/time-of-day/
    from the wiki Plugin page (http://wiki.wordpress.org/Plugin )
    Enjoy!

  3. Vohiyaar
    Member
    Posted 10 years ago #

    Sweet!
    What about the time_since one? Ok, maybe I'm asking for too much!!!
    :-)

  4. masquerade
    Member
    Posted 10 years ago #

    Dustan, did you get the e-mail that I sent you about the source code? I want to use it but I need to be sure it is open source and not proprietary.

  5. carthik
    Member
    Posted 10 years ago #

    Vohiyaar, if it is there, it should be there on the wiki plugin page, the link to which I posted.
    Masquerade, dunstan doesn't seem to know of this thread.

  6. Anonymous
    Unregistered
    Posted 10 years ago #

    Nice plugin, but when I try to change options in the Admin > Options area, I get this php error:
    Warning: Cannot modify header information - headers already sent by (output started at /public_html/journal/wp-content/plugins/time-of-day.php:72) in /public_html/journal/wp-admin/options.php on line 115
    Any suggestions?

  7. ifelse
    Member
    Posted 10 years ago #

    Hi all,
    This is my first plugin so if anyone has any suggestions, coding or otherwise, feel free to suggest them.
    Anyways, Anonymous, can you check that the last line of the plugin file is ?> and that there are no trailing carriage returns or new lines.

  8. Anonymous
    Unregistered
    Posted 10 years ago #

    That must be it. It has ?> but I didn't think to check for new lines. I'll check and get it uploaded.

  9. ifelse
    Member
    Posted 10 years ago #

    I've edited the file at the download location so you should (hopefully) no longer get this issue.

  10. Anonymous
    Unregistered
    Posted 10 years ago #

    Thanks, ifelse.
    That solved it. No more leaks. I also made a plugin for comments links. Kind of sloppy though. It's called Dumb Comments Link.

  11. mufflonen
    Member
    Posted 10 years ago #

    I do also have the problem with using this between 7 & 10..I will disable it on my blog and try to solve this. any ideas?

  12. wairoanz
    Member
    Posted 10 years ago #

    @mufflonen: Glad it's not only me... If you figure it out please post back here. I'll do the same.
    @Fernando: I'm not sure how to install the Dumb Comments Link plugin.... I uploaded and activated the plugin, then incerted <?php dumb_comment_link() ?> into my index.php... but when trying to view the web pages I get:

    Fatal error: Call to undefined function: dumb_comment_link() in /home/httpd/vhosts/wairoa.com/httpdocs/index.php on line 98

    Is there something else I need to do to get this working? Please advise, thanks.

  13. ifelse
    Member
    Posted 10 years ago #

    @mufflonen/@wairoanz
    I can't seem to reproduce this 7-10 error. For example, I altered the timestamp in the following entry to 7:16 am but I get the correct entry of "early morning".
    http://www.ifelse.co.uk/archives/2004/07/26/discussion-board/
    Can you tell me the time value that the plugin is failing on?

  14. wairoanz
    Member
    Posted 10 years ago #

    @ifelse
    I have avtivated the plugin again, see: http://www.wairoa.com/
    Please see this article http://www.wairoa.com/2004/07/27/slices-of-wairoa/ filed at 09:34:20 am just shows "Filed under: District Info" and not "Filed in the morning under: District Info" (as it should be.
    Postings outside the 7am to 10am timeframe show as they are intended, i.e. http://www.wairoa.com/2004/07/26/trout-fishing-ruakituri-river-new-zealand/ shows... "Filed late morning under: District Info"
    To be honest, I can't see how it can be a problem with the script, there must be something else at play... but if two people are getting the same problem I guess there will me others soon too.
    If you need any more information please let me know.

  15. wairoanz
    Member
    Posted 10 years ago #

    Update: Well, make a lier out of me! :) I just found one morning post, filed at 07:10:50 am that IS showing correctly... http://www.wairoa.com/2004/07/23/waikaremoana-hut-fees-increase/
    So I don't know... :( seems too wierd.

  16. ifelse
    Member
    Posted 10 years ago #

    Thanks for that update. The date/time value allowed me to replicate the issue on my system.
    I've uploaded a new version of the code at:
    http://www.ifelse.co.uk/code/timeofday.php
    Could you test if this solves your issue?

  17. wairoanz
    Member
    Posted 10 years ago #

    Yup! That fixed it! Thanks ifelse!

  18. mufflonen
    Member
    Posted 10 years ago #

    yes, thanks for the update, it works like a charm. very needed since I am working at the moment and seem to post everything "early in the morning" :DDD

  19. Fernando
    Member
    Posted 10 years ago #

    @wairoanz
    Sorry. Call it with <?php dumb_comments_link() ?>. I accidently published it with "comment" instead of the plural "comments."
    And sorry to post this in this topic.

  20. GabrielRadic
    Member
    Posted 10 years ago #

    Would it be possible to have the same for comment dates?

  21. CarLBanks
    Member
    Posted 10 years ago #

    I would love this to be used in the comment times.
    This plugin is great!

  22. ifelse
    Member
    Posted 10 years ago #

    I've updated the code so that you pass in a date value rather than the post_id. This will mean that it should work for comments as well.
    Note the usage method has changed to:
    <?php time_of_day(abs(strtotime($post->post_date)));?>
    To use it for comments, try the following:
    <?php time_of_day(abs(strtotime($comment->comment_date)));?>
    Note, I've disabled comments on my site, so comment usage is not as well tested. Give me a shout if it works/breaks.

  23. CarLBanks
    Member
    Posted 10 years ago #

    It didn't break anything has far has I can see.

  24. Anonymous
    Unregistered
    Posted 10 years ago #

    I ran into the same non-appearing-date problem during certain hours & made the following modification with successful results:
    In the main switch statement, I changed all case statements to check for strings & it seems to have fixed all problems (not quite sure why tho).
    From >>
    case 00:
    case 01:
    case 02:
    [...]
    To >>
    case '00':
    case '01':
    case '02':
    [...]

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.