Tagged: Latest News, Widget
-
AuthorPosts
-
June 11, 2016 at 11:10 am #646514
Is it possible to remove the time stamp and the dash – (not the date) in widget “Latest news”. I only find .news-time in CSS.
June 11, 2016 at 1:58 pm #646538Hey Roine,
This is not possible in CSS but it can be done in jQuery.
Give me some time to write a custom function for you i will help you out :)
Best regards,
VinayJune 14, 2016 at 1:11 am #647714Hi,
Please try adding this at the very end of your themes / child themes functions.php file:
function custom_time_stamp(){ ?> <script> jQuery(window).load(function(){ jQuery('.news-time').each(function () { var text = jQuery(this).text(); text = (text.length > 15) ? text.slice(0,-9) : text; jQuery('.news-time').text(text); }) }); </script> <?php } add_action('wp_head', 'custom_time_stamp');
Best regards,
VinayJune 14, 2016 at 11:10 am #647897Nearly perfect. I changed –9 to –8 and it works nice in Swedish date format.
Thanks!June 15, 2016 at 6:32 am #648407Hi,
Great, glad we could help. Please let us know if you should need any more help on the topic.
Thanks,
RikardJuly 6, 2016 at 7:59 pm #657702I copied the code in my child themes funcktions.php, but it has not changed. The time is still displayed. What did I do wrong? To see the contents of the file functions.php:
<?php /* * Add your own functions here. You can also copy some of the theme functions into this file. * WordPress will use those functions instead of the original functions then. */ function custom_time_stamp(){ ?> <script> jQuery(window).load(function(){ jQuery('.news-time').each(function () { var text = jQuery(this).text(); text = (text.length > 15) ? text.slice(0,-9) : text; jQuery('.news-time').text(text); }) }); </script> <?php } add_action('wp_head', 'custom_time_stamp'); ?>
July 6, 2016 at 11:16 pm #657770Hi,
Would you mind providing a precise link to your site, showing the elements in question? We need to be able to inspect them in order to help :)
Best regards,
VinayJuly 7, 2016 at 10:25 am #657865I mean the time below the post title in “Letzte Neuigkeiten” below in the right sidebar.
July 8, 2016 at 11:52 am #658337Hi,
Please try the following in Quick CSS under Enfold–>General Styling:
.sidebar .news-time { display:none !important; }
Thanks,
RikardJuly 9, 2016 at 10:47 pm #658868Thank you for your response. It works. But the date should be remain, so I tried it with the code in the functions.php.
July 11, 2016 at 3:51 pm #659362Hi,
I’m not sure what you mean by your last post, did the CSS I posted render the results you are looking for or not? Don’t use the code I sent in functions.php since it won’t accept code like that.
Best regards,
RikardJuly 11, 2016 at 9:14 pm #659546Hi Rikard,
I tryed the CSS, but it hide also the date. It would be better if only the time disappears.July 11, 2016 at 11:34 pm #659574 -
AuthorPosts
- You must be logged in to reply to this topic.