• Resolved david4ww

    (@david4ww)


    I want to display the date as 13th May 2020 in the actual event post (I use the general date setting “jS F Y”, but sometimes only want to display the date as 13th May (i.e. without the year) – in particular when I am displaying lists of events in narrower spaces such as the sidebar. Perhaps there is some ‘hack’ I could implement to achieve this, or perhaps this could be a future feature as a shortcode parameter of some sort?
    Thanks – great plugin by the way.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Guido

    (@guido07111975)

    Hi David,

    You can only do this by changing the relevant plugin file itself. I can help you with that, if you want this. But in case of plugin update you need to do it again. I might add a (shortcode) attribute for date format in next plugin version, but currenlty I don’t have time for that.

    Guido

    Thread Starter david4ww

    (@david4ww)

    Thanks Guido.
    I would rather not go down the route of changing the plugin itself if it can be avoided for the reason that you state and would obviously prefer some sort of shortcode attribute but accept that I may have to live without that option.

    So, out of curiosity, I did have a look at the plugin files, and it would appear that perhaps all I would need to do is modify the vsel-page-template.php file at line 50 where a single date is output (I only ever use single dates) so rather than use esc_attr($date_format) in the sprintf() statement instead use esc_attr(‘jS F Y’) so that on event posts themselves the date always displays the year, then set the VSEL general date setting to just js F so the date without a year is used elsewhere (i.e. in my event lists)?

    Plugin Author Guido

    (@guido07111975)

    Hi,

    That’s correct, you can hardcode the date format. The file you’ve mentioned is for the shortcode. For the widget you should change file “vsel-widget-template”. But once changed, this will apply to all event lists that are being generated by that file. So all event lists that you have created by using the shortcode at a page or by using the widget.

    But you know, I will try to make some spare time next weekend to add a (shortcode) attribute so you are able to change date format per shortcode / widget.

    Guido

    Thread Starter david4ww

    (@david4ww)

    Thanks Guido – very helpful.
    I’ll wait for before diving in and hacking code to see if you have the time to come up with anything more elegant!
    David

    Plugin Author Guido

    (@guido07111975)

    FYI when adding an attribute to change date format this will not apply to the single event page, because that page is not generated by the shortcode or the widget.

    Will keep you informed regarding the update.

    Guido

    Plugin Author Guido

    (@guido07111975)

    Hi David,

    Have updated plugin. You can use this attribute to change date format per event list:

    
    date_format="j F Y"
    

    Guido

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Different date formats via shortcode?’ is closed to new replies.