• Hi, i struggle with the correct filter shortcode to show members who have their birthday in the current and next month. I have setup a date calculation field with [birthday]=[?month_day], but i can’t get them to show in a list.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author xnau webdesign


    For something like this you will need some custom code to make it work the way you want.

    The reason is that for this to work, you will need to make a string comparison between the person’s birthday (typically the month and day of the month) and the name of the current and next month. There is no dynamic key to use in the list shortcode filter to get the current month as a string, so you need to do this with some of your own code. You can do this in a custom template or you can make a custom shortcode for this.

    The custom code would dynamically build the shortcode based on the current month…for example:

    $this_month = date('F');
    $next_month = date('F', strtotime('+1 month') );
    $filter = 'birthday~' . $this_month . '|birthday~' . $next_month;
    do_shortcode('[pdb_list filter=' . $filter . ']');

    That’s the basic idea, you’ll need to modify that to work in your specific case. This will dynamically create a filter for the current month, for example: “birthday~January|birthday~February”

    Full details on how to build list shortcode filters here: List Shortcode Filters

    Thread Starter knireis


    Sorry, i have not been able to figure out what to do with this code. I changed ‘birthday’ in the name of the databasefield i use ‘geboortedatum’ , then i copied the code in codesnippets plugin to see what happens. But it immediately gave a critical error on my site. With phpmyadmin i removed the snippet again.

    Can you explain how to use the code you provided?

    Plugin Author xnau webdesign


    I would not recommend the use of php snippets, they can work in limited cases, but probably no good for something like this.

    Code like this can be used in any one of these ways:

    You can add this code to a custom wordpress template.
    You can use this code in a custom shortcode method.
    You can use this in a custom Participants Database template.

    Thread Starter knireis


    Hi, thanks for your efforts to help, but i can not get this to work.

    So i gave up on the idea of the dynamic list. If i can filter on birthday month that should be at least something to work with.

    So i set up a datecalculation field and entered [birthday]=[?day_month] in the template field. “birthday” is the name of the datefield.
    However when i create a shortcode to display a list with names and the datecalculation field, the datecalculation field remains empty.

    Thread Starter knireis


    I changed strict date setting to ‘on’ . And now i get output. But us in english so i can not use that.

    I switched to the string combine field type and now i get the output in localized language. So i can use that for a search field.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.