Title: Use dynamic date in shortcode: do I need php?
Last modified: July 28, 2020

---

# Use dynamic date in shortcode: do I need php?

 *  Resolved [berttervoert](https://wordpress.org/support/users/berttervoert/)
 * (@berttervoert)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/use-dynamic-date-in-shortcode-do-i-need-php/)
 * 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](https://wordpress.org/support/users/keraweb/)
 * (@keraweb)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/use-dynamic-date-in-shortcode-do-i-need-php/#post-13246335)
 * Hi [@berttervoert](https://wordpress.org/support/users/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](https://www.w3schools.com/sql/func_mysql_week.asp)
 * Cheers, Jory
    -  This reply was modified 5 years, 10 months ago by [Jory Hogeveen](https://wordpress.org/support/users/keraweb/).
    -  This reply was modified 5 years, 10 months ago by [Jory Hogeveen](https://wordpress.org/support/users/keraweb/).
 *  Thread Starter [berttervoert](https://wordpress.org/support/users/berttervoert/)
 * (@berttervoert)
 * [5 years, 10 months ago](https://wordpress.org/support/topic/use-dynamic-date-in-shortcode-do-i-need-php/#post-13252555)
 * 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.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

## Tags

 * [dynamic date](https://wordpress.org/support/topic-tag/dynamic-date/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 2 replies
 * 2 participants
 * Last reply from: [berttervoert](https://wordpress.org/support/users/berttervoert/)
 * Last activity: [5 years, 10 months ago](https://wordpress.org/support/topic/use-dynamic-date-in-shortcode-do-i-need-php/#post-13252555)
 * Status: resolved