Created
June 6, 2023 19:33
-
-
Save jassriver/ee8b1fb1eae3a9c8144fce6912188dff to your computer and use it in GitHub Desktop.
pegar_filmes_de_2_anos_atras_ate_agora
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ano_atual = date('Y'); | |
$dois_anos_atras = $ano_atual - 2; | |
$args = array( | |
'post_type' => 'filmes', | |
'meta_query' => [ | |
'relation' => 'AND', | |
[ | |
'key' => 'genero', | |
'value' => 'ação', | |
'type' => 'CHAR' | |
], | |
[ | |
'key' => 'genero', | |
'value' => 'suspense', | |
'type' => 'CHAR' | |
], | |
[ | |
'relation' => 'AND', | |
[ | |
'key' => 'ano_lancamento', | |
'value' => $dois_anos_atras, | |
'type' => 'NUMERIC', | |
'compare' => '>=' | |
], | |
[ | |
'key' => 'ano_lancamento', | |
'value' => $ano_atual, | |
'type' => 'NUMERIC', | |
'compare' => '<=' | |
] | |
] | |
] | |
); | |
$query = New WP_Query($args); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment