acf-permalink icon indicating copy to clipboard operation
acf-permalink copied to clipboard

How do you use multiple date parts?

Open drnickyoung opened this issue 6 years ago • 1 comments

Hi,

Firstly an excellent plugin. I might be missing the obvious here, please point it out if I am.

I have an event post type, with a field event_date. I would like each event to have the permalink structure:

mysite/events/YEAR/MONTH/POST

i.e. mysite/events/2018/november/myevent

So using this plugin, in the permalinks settings I enter for the events permalink:

/%field_event_date(year)%/%field_event_date(format=F)%/%postname%/

This doesn't work, the permalink is set to:

mysite/events/2018-12-13/test-event/

It clearly has picked the date out, 13 Dec 2018. However not what I expected. doing it without the month,

/%field_event_date(year)%/%postname%/

seems to work fine and results in:

mysite/events/2018/test-event/

So question is, am I doing something wrong, or is this not possible?

drnickyoung avatar Nov 25 '18 13:11 drnickyoung

Hello,

Thank you for contact.

Seems that plugin has a problem witch using the same field more that one time. I see 2 options for now:

  1. Use schema similar to /%field_event_date(format=Y/F)%/%postname%/, however it results witch not exactly what you wanted, because it results mysite/events/YEAR-MONTH/POST (no slash between year and month).
  2. You could use this filter and create event_date2 field dynamically (based on event_date) and use it /%field_event_date(year)%/%field_event_date(format=F)%/%postname%/.

Fixing this issue might take some time, but here are some workarounds for now.

If you found plugin useful, you can rate it ⭐️ in Wordpress Plugin Directory :)

Piotr.

athlan avatar Nov 25 '18 20:11 athlan