I need:
I need the custom fields organized in pairs. The first part of the pair will be the date and the second part will be the state. State can be 0, 1 or 2 the date is quite simple. The result might be like that:
post #1 / 1.1.2020/ State: 0
post #2 / 2.1.2020/ State: 1
post #3 / 3.1.2020/ State: 1
post #4 / 3.1.2020/ State: 2
post #5 / 5.1.2020/ State: 0
post #6 / 6.1.2020/ State: 2
post #7 / 7.1.2020/ State: 0
...
Then I want to create a loop and ask for displaying a list of all posts in a given period. e.g: list all posts between 3.1.2020 and 5.1.2020 The posts should have different classes according to their state. So the output could look like:
<div id="post3 class="state1">...</div>
<div id="post4 class="state2">...</div>
<div id="post5 class="state0">...</div>
I suppose it is possible, but I do not know how to group the custom filds in the right way. Maybe somebody could give me a hint. Using a plugin such as ACF is OK, if necesairy.
Thanks
Raphael
custom field 1 might be a date,
custom field q a state (0, 1 or 2)
custom field 3 might be a date,
custom field 4 a state (0, 1 or 2)
custom field 5 might be a date,
custom field 6 a state (0, 1 or 2)
So how can I guarantee that field 11 is grouped with field 2, and field 3 is grouped with field 4 … That is my basic-question.
I read in the documatation of the plugin “Advanced Custom Fields (ACF) that this plugin can group the fields. But I do not know if that means exactly that what I want.
It is a bit hard to explain what I want. So the first thing should propably be that we make sure to talk about the same thing.
]]>If you want to query by date meta values, either store the date as a timestamp or in “yyyy.mm.dd” format so that ordering and ranges work as expected.
]]>