How to show only the daynumber of an event

Home Forums Calendar Products Events Calendar PRO How to show only the daynumber of an event

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #943525
    ite
    Participant

    Hi, Trying to create a calendar-icon where the month is specified first (M) and then a span with the number of the day the event takes place.

    I used the following code for the month:
    <?php echo apply_filters( ‘tribe-mini_helper_tribe_events_ajax_list_dayname’, date_i18n( ‘M’, $postDate ), $postDate, $class ); ?>
    And it worked at first but is no longer working.
    Are there an easier way for this?

    #943571
    Barry
    Member

    Hi ite — can you provide a little more context? Where is that code running, for example – is it within a template override for the calendar widget?

    #943912
    ite
    Participant

    Hi, I´m trying to use this in a template override for the activity list widget for example.
    But also in an template override for single event.

    #943914
    Barry
    Member

    OK – and is it not working in either context? What is the actual problem – is it simply showing nothing at all?

    To get the day number itself, though, you would use some code like this (assuming $postDate is set to a valid value):

    date_i18n( 'd', $postDate )

    #943917
    ite
    Participant

    Thanks, but by using this it shows 01 (for ‘d’) and Jan (‘M’)…
    Both in single-event.php and list-widget.php…

    #943930
    Barry
    Member

    Isn’t the number of the day what you want here? To be clear, you wouldn’t replace the existing date_i18n() call – rather you would add this one to the same piece of code.

    If you don’t wish to have leading zeroes you can use j instead of d – please see the following for more details:

    However, though I wish we could help further, I’m afraid it’s very much a customization task and something you’ll need to move forward with by yourself or – if you need further assistance – it may be worth seeking the help of a suitable WP/PHP dev.

    Sorry we can’t do more on this occasion but I hope this at least has given you a few ideas. Thanks again 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘How to show only the daynumber of an event’ is closed to new replies.