• Resolved berttervoert

    (@berttervoert)


    Hi,
    for a pod I created, I need to use a shortcode which sorts data by date, but dynamicaly: I always want to display the entries that have the current weeknumber or the number for next week. My pod has a week number field to be able to sort on that.
    I have been reading through your tutorials and this forum, and understand I can’t use php in the shortcode. Is it possible to create a function that returns the pods shortcode, or am I over-complicating things that way and should I use a custom template to get this working?
    Would like to hear your opinion on this.
    Thanks in advance,
    Bert.

    PS: I tried several event plugins to get this done, but they are either to extensive for my purpose or they have zero flexibility to alter the output.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @berttervoert

    There are some SQL functions you could use in the where param like NOW() for the current date.
    You can also use the WEEK() function: https://www.w3schools.com/sql/func_mysql_week.asp

    Cheers, Jory

    Thread Starter berttervoert

    (@berttervoert)

    Ok, thank you, I’ll look into that.

    I was wondering if I made a mistake in my line of thinking as I discribed above: I can make a function that returns a shortcode, but will this shortcode be executed or only be displayed? Do you have any thoughts on that?

    I’ll play around with your suggestion and let you know how it works (or not).

    Thanks,
    Bert

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Use dynamic date in shortcode: do I need php?’ is closed to new replies.