3
I’m trying to create a calendar page in Wordpress where the user selects the month by a select
:
<select>
<option>Janeiro 2015</option>
<option>Dezembro 2014</option>
<option>Novembro 2014</option>
<option>Outubro 2014</option>
<option>Setembro 2014</option>
</select>
Then the posts are loaded via Ajax. I created a form like POST
called agenda
and a custom field called agenda_data
.
I need help on two items, the rest I think I can handle on my own.
In the
select
appear the last 12 months, the Wordpress functionwp_get_archives
does this. But it returns based on the publication dates and I’d like it to be based on the date of the custom field.A
archive.php
that displays posts also based on the date of the custom field and not by the date of post publication.
I haven’t found anything yet on the Internet that could help me.
I didn’t understand the part
baseado na data do campo personalizado.
What field is this? How do you customize it?– Lollipop
Shows the full form.
– Lollipop
A custom field, where you inform the date of the event, understood ?
– Sérgio Machado
Sergio, could you put the code you are using? Is the value of the custom field being recorded as a date or in another format? Could put the code that creates the custom field tb?
– Ricardo BRGWeb
Opa Ricardo, all right ? now I’m using the same native date of Wordpress. I didn’t know but it is possible to display a post even though it is scheduled for a future date, using 'post_status' => 'Future'. Now I’m just having problems loading by ajax anyway.
– Sérgio Machado
@Sérgiomachado, you managed to solve the problem by using the
wp_get_archives()
? And how are you doing the AJAX loading?– Caio Felipe Pereira