Support » Plugin: Custom Content Shortcode » how to filter loop by custom date field created by Types plugin (unix timestamp)

  • Resolved James Revillini

    (@jrevillini)



    Here’s what my loop looks like:

    [loop type=class field="wpcf-class-date-time" after="1 day ago" before="+15 days" date_format="U" order=ASC orderby="fieldnum" key="wpcf-class-date-time" list=true list_class=upcoming-classes]...[/loop]

    the custom field is wpcf-class-date-time and is stored as a UNIX timestamp (which I’m guessing is my issue)

    am I coding it wrong or is the unix timestamp value an issue for comparison using before and after attributes?

    https://wordpress.org/plugins/custom-content-shortcode/

Viewing 4 replies - 1 through 4 (of 4 total)
  • update: this worked for filtering

    [loop type=class field="wpcf-class-date-time" value="future"]...[/loop]

    but I still get no entries if I add in these attributes: order="ASC" orderby="fieldnum" key="wpcf-class-date-time" list="true" list_class="upcoming-classes" so there is some conflict in my attributes.

    i’m an idiot. i put in orderby=fieldnum and it should have been orderby=field_num.

    CASE CLOSED

    final code for those trying to do the same:

    [loop type=class field="wpcf-class-date-time" value="future" date_format="U" order=ASC orderby="field_num" key="wpcf-class-date-time" list=true list_class=upcoming-classes]...[/loop]

    Plugin Author Eliot Akira

    (@miyarakira)

    Hello,

    Thank you for posting the solution, I’m glad you figured it out. I wonder why before and after parameters didn’t work.. I’ll try to look into it when I have time.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘how to filter loop by custom date field created by Types plugin (unix timestamp)’ is closed to new replies.