Compatibility with Local Time plugin
-
I’m loving Graphene and the Neo plugin, however I am having an issue with one particular plugin that displays post and comment dates and times in a visitor’s local timezone using Javascript:
http://wordpress.org/plugins/localtime/
It doesn’t show up properly with Graphene, I’m assuming because it’s looking to replace the time in the date line and Graphene just displays the date. I can do without it but would prefer to still use it, if there’s a viable workaround to make it compatible. Appreciate any advice!
Mod
Wow—that is one of the worst plugin pages I have ever seen in the WordPress repository. And it’s based on somebody else’s theme and it hasn’t been updated in a while. You, sir, are a brave man.
How does this plugin work? Does it use a short code or a bit of php? If that’s the case, you could hide Graphene’s built-in date and then just use an action hook widget area.
It uses Javascript to change the timestamp to the user’s local time. It seems to work fine with any theme that displays the time and date in posts, but since Graphene just displays the date, it’s not sure what to do. For example, when it tries to change the time on a post that was made on January 11th 2014 at 10:20 AM, it’ll output the date as:
2014-01-11T10:20″> 2014-01-11T10:20:01+00:00″>
I’m just wondering if there’s an easy way to display the time of posts in Graphene next to the date, I have a feeling it might work. It does work properly for the comments in Graphene, which do display the time along with the date.
Mod
You can use a PHP widget in a Graphene action hook widget area with the appropriate WordPress php fuction. I believe
is_time()
would work, but I may be (probably am) wrong on that one. I haven’t looked into it too closely.Thanks for the advice, but I can’t seem to get that to work the way I want, getting the timestamp of the post and positioning it where I’d like.
Is there any other way to display the time alongside the date in Graphene? Alternatively, if someone could provide more insight on how to grab the time of the post and replace the date with the appropriate action hook widget?
Try with this in your child-theme functions.php:
function getthimestamp ($post_ID) {
?> <span class="time"><?php the_time( 'H:i' ); ?></span>
<?php
return $post_ID;
}
add_action( 'graphene_post_meta', 'getthimestamp' );It will insert the time next to category… then you can style it in css like:
.time {
position:absolute;
left:5px;
top:18px;
font-weight:bold;
}Thanks, tried it out and that does display the time, which the plugin successfully updates according to the user’s time zone. However, the date itself is still messed up, as it’s trying to change the timestamp that’s displayed when you mouseover the date.
Anyway to remedy that, and preferably use the inline text option for the date? Thanks again for all the help so far. 🙂
Link to your site?
Here’s our test site where we’re getting everything set up with Graphene, tweaking the colours and whatnot:
I’ve activated the plugin so that you can see what’s happening. Appreciate you taking a look! 🙂
Viewing 10 posts - 1 through 10 (of 11 total)
- 1
- 2
- You must be logged in to reply to this topic.