Skip to content

Instantly share code, notes, and snippets.

@jassriver
Created June 6, 2023 19:33
Show Gist options
  • Save jassriver/ee8b1fb1eae3a9c8144fce6912188dff to your computer and use it in GitHub Desktop.
Save jassriver/ee8b1fb1eae3a9c8144fce6912188dff to your computer and use it in GitHub Desktop.

Revisions

  1. jassriver created this gist Jun 6, 2023.
    36 changes: 36 additions & 0 deletions index.php
    Original 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);