Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #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.

    #646538

    Hey 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,
    Vinay

    #647714

    Hi,

    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,
    Vinay

    #647897

    Nearly perfect. I changed –9 to –8 and it works nice in Swedish date format.
    Thanks!

    #648407

    Hi,

    Great, glad we could help. Please let us know if you should need any more help on the topic.

    Thanks,
    Rikard

    #657702

    I 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');
    ?>
    
    #657770

    Hi,

    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,
    Vinay

    #657865

    I mean the time below the post title in “Letzte Neuigkeiten” below in the right sidebar.

    #658337

    Hi,

    Please try the following in Quick CSS under Enfold–>General Styling:

    .sidebar .news-time {
    display:none !important; 
    }

    Thanks,
    Rikard

    #658868

    Thank you for your response. It works. But the date should be remain, so I tried it with the code in the functions.php.

    #659362

    Hi,

    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,
    Rikard

    #659546

    Hi Rikard,
    I tryed the CSS, but it hide also the date. It would be better if only the time disappears.

    #659574

    Hey!

    Please add following code to Functions.php file in Appearance > Editor

    add_filter('avia_widget_time', 'change_avia_date_format', 10, 2);
    function change_avia_date_format($date, $function) {
      $output = date( 'Y-d-m');
      return $output;
    }

    Cheers!
    Yigit

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.