Created
June 6, 2023 19:33
-
-
Save jassriver/ee8b1fb1eae3a9c8144fce6912188dff to your computer and use it in GitHub Desktop.
Revisions
-
jassriver created this gist
Jun 6, 2023 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ <?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);