Support » Plugin: Gutenberg Blocks – Ultimate Addons for Gutenberg » Timeline only with years

  • Resolved Daniel

    (@damen02)


    Great plugin, huge enhacement for Gutenberg.
    I wonder if there is a simple way to put just the year in timelines, instead of the complete date format. I mean, if I put 2010 teh plugin automatically changes it to 31/12/2009. Is there any simple way to avoid this? Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Team Brainstorm Force

    (@brainstormteam)

    Hey @damen02,

    You can use the get_the_date filter of WordPress to change the date format.

    You can add the following code to your child theme’s functions.php file:

    add_filter( 'get_the_date', 'change_date', 10, 3 );
    function change_date( $the_date, $d, $post ) {
    	return date('Y');
    }

    Hope this helps!

    Regards,
    Balachandar Karuparthy

    Hi,
    I tried to add the following code, but unfortunately it doesn’t work for me. It changes dates of my posts but it doesn’t change the format of timeline’s dates (content timeline block).

    Can you help me ?

    Plugin Support Team Brainstorm Force

    (@brainstormteam)

    Hey @margauxrdesign ,

    Thank you for reaching us out.

    Here the date format shows the only year, you need to change the format by changing the string here – return date(‘Y’);

    You can find more about the date format here – https://www.php.net/manual/en/function.date.php

    I hope that helps you.

    Regards,
    Vrunda Kansara

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Timeline only with years’ is closed to new replies.