Tagged: child theme, date, time
-
AuthorPosts
-
February 12, 2014 at 3:55 am #222519
Hello:
I would like to hide just the time in the date/time output of the Posts widget.
I have found the following code in /framework/php/class-framework-widgets.php
echo "<span class='news-time'>".get_the_time($time_format)."</span>";
But am not sure what format I should pass instead of $time_format, or indeed if I can add this file to my child theme and hope to make it work.
Mainly I’m comfortable in HTML/CSS, less so in PHP.
Thanks
February 12, 2014 at 4:20 am #222530Hi!
Replace
echo "<span class='news-time'>".get_the_time($time_format)."</span>";
By this:
echo "";
Regards,
JosueFebruary 21, 2014 at 2:42 pm #227492Hey!
Any clue how can i do this in my Enfold child theme?
Thanks,
Rhodo
February 21, 2014 at 2:52 pm #227497Hi!
You can moify class-framework-widgets.php file and paste it in /framework/php/ folder in your child theme
Cheers!
YigitFebruary 21, 2014 at 3:22 pm #227508Thanks Yigit!
But now i actually see that the the main question isnt answered properly:
from this line:
<span class='news-time'>".get_the_time($time_format)."</span>
How can i just remove the time.
so: 21 februari 2014 – 15:08 becomes –> 21 februari 2014?Even if i remove the code like Josue says and edit it in the child theme placed file like you suggested it still shows up?!
Any idea?
February 21, 2014 at 5:25 pm #227573March 1, 2014 at 6:31 pm #231102Dear Yigit,
Thanks this code works but only in the main Enfold theme. How can i do this in the child theme?
Your answer:
You can modify class-framework-widgets.php file and paste it in /framework/php/ folder in your child theme
Doesn’t work.
Rhodo
March 1, 2014 at 11:36 pm #231137I second Rhodo’s point…I tried putting my copy of this file in the same structure in my child theme and none of the changes work. I have to keep updating the parent theme version. Is this a change to how WP handles the ordering in child themes? The docs on the WordPress codex are a bit arcane for anything that isn’t strictly page templates or css.
March 4, 2014 at 9:33 am #232102Hi!
Use this filter code and add it to the bottom of your child themes functions.php to change the date/time format:
function change_avia_date_format($date, $function) { if(!empty($function) && $function != 'avia_get_comment_list') $date = get_option('date_format'); return $date; } add_filter('avia_widget_time', 'change_avia_date_format', 10, 2);
The code will remove the time and return the date only.
Regards,
PeterMarch 4, 2014 at 12:06 pm #232149Thanks a lot Peter! That solved it :-)
March 4, 2014 at 12:40 pm #232160Hey!
Great :)
Regards,
PeterJune 9, 2016 at 12:58 pm #645408Thank you Peter Dude…I love that you often supply the function, I find this a much better approach than hiding source with css. Much appreciated.
Darryl -
AuthorPosts
- The topic ‘Hide time (not date) in posts widget in Child theme of Enfold’ is closed to new replies.