WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Building log hour counter..

[Resolved] Building log hour counter..

  • Hey everyone.

    I am running building log over a large project, and would love to be able to show the elapsed working hours.
    I guess it should be a plugin that adds another field to the post entries, which then could be calculated to show total hours.

    Does anybody know if there is already a plugin out there that does this?

    Thanks in advance,
    Steffen.
    http://www.rv-7.dk

Viewing 13 replies - 1 through 13 (of 13 total)
  • ‘comment_date’ or ‘comment_date_gmt’ field under ‘wp_comments’ table

    Hmm, sorry I dont have much coding experience, how can these fields help me?

    1. Convert the current time and the comment time into time stamps.
    2. Calculate the difference.
    3. Convert the difference back into time.

    Never mind. I’ve made a simple plugin. I’ll release it within 24 hours.

    Ask Google about ‘WordPress Plugin: WP Relative Post Time 1.0.’

    Hi macsoft,

    Thanks you for trying to help, but maybe I expressed my needs badly. I am not trying to calculate how much time I spend on writing the blog, but how much time I spend on building the plane I write about on my blog. If you look at my blog, you can see that I add the spent hours at the end of each post title.
    My thoughts were, if I could write these numbers in a post field somehow, a script could calculate the total hours spent and display it on my website menu.

    best regards,
    Steffen

    Ahh… You mean, 3½h, 5h like that?

    You definitely need to create a custom field or a separate table. There can be no common WP plug-in for that for sure.

    It won’t be very difficult to achieve the goal, depending on where and how to display the total hours. Since it cannot be difficult, it will be better if you learn how to write basic PHP programs for yourself.

    Ok, I will set aside a weekend for it! 🙂
    Thank you for your replies…

    Steffen.

    Ok, I have added a custom field to my post, called it ‘Hours’

    When I do this lookup in phpmyadmin it displays the total hours:

    select SUM(meta_value) from wp_postmeta WHERE meta_key=’Hours’

    But what is the code to add this to my website sidebar?

    You need a blueprint at first as to ‘where and how to display the total hours.’ Learning how to use phpMyAdmin to make queries won’t lead you anywhere. You need to know how to make SQL queries with PHP.

    Exactly! ..and I’m having trouble with that, so I was hoping for help through this forum.

    The phphMyAdmin can show the querie in php-code, but that doesn’t help me much eather:

    $sql = ‘select SUM(meta_value) from wp_postmeta WHERE meta_key=\’Hours\”

    Ok, just got the code I was looking for from another forum:

    // Make a mysql Connection
    $query = mysql_query(“SELECT sum(meta_value) AS ‘meta_sum’ FROM wp_postmeta WHERE meta_key=’Hours'”) OR DIE(mysql_error());

    while($row = mysql_fetch_assoc($query))
    {
    echo $row[‘meta_sum’];
    }

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Resolved] Building log hour counter..’ is closed to new replies.