• Resolved cunisimo

    (@cunisimo)


    I have this code:

    [pods template=”Cumpleanos-Empleados-home” name=”empleado” limit=”3″ orderby=”DATE_FORMAT(cumpleanos.meta_value,’%m%d’)” where=”TIMESTAMPDIFF(YEAR, cumpleanos.meta_value, CURDATE()) < TIMESTAMPDIFF(YEAR, cumpleanos.meta_value, ADDDATE(CURDATE(), 10))”][/pods]

    Which shows birthdays up to 10 days in the future. But the thing is that the ones that correspond to current day do not appear. For example, it shows me the birthday of tomorrow, but tomorrow it will not show it. I would need to know what method to use to show me only the current day.

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

    (@keraweb)

    Hi @cunisimo

    You are comparing with <. Since you also need today you should compare with <= (Less than or equal to).

    Cheers, Jory

    Thread Starter cunisimo

    (@cunisimo)

    Hi Jory.

    I tried your proposal and it shows me dates from January this year.
    So I used the following line of code:

    [pods template=”Cumpleanos-Empleados-home” name=”empleado” limit=”3″? where=”cumpleanos.meta_value = CURDATE()”][/pods]

    and it worked, but now the problem is that it only brings me birthdays of the current day including year. So it does not show me birthdays with year of birth before 2023-

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @cunisimo

    In the last shortcode example you’ve send you do not cast the meta value as a DATE, this might cause incorrect behavior.
    Please make sure to cast your values in the correct format before comparing.

    Anyhow, since you mention birthdays, you’ll need to adjust your query for this to work.
    See this topic for the answer: https://stackoverflow.com/a/27775744

    Cheers, Jory

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Shortcode to show table of the current day’ is closed to new replies.