Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

154
Visualizações
Elementor custom filter query show post by category and slug

I would like to ask you for your help. What I'm trying to achieve:

I use an elementor. I created a category page template. You can check this on http://estate.romanjelinek.cz/lifestyle . what I'm trying to do is display posts from the Lifestyle and promotion categories on this page. Promotion has two tags (Paid and Unpaid). I need to display first the posts from the category Promotion with the tag Paid (sorted by publication date) and only then all the others (ie together Lifestyle and Promotion with the tag Unpaid). So this is the logie

  1. Promotion Paid
  2. Lifestyle + Promotion Unpaid

Promotion Paid need to be first and no matter the date of publication, you just always have to be ahead of the rest in, if there is no posts in promotion Paid, then only 2)

I tried to use this custom query but doesnt work

// Showing post with meta key filter in Portfolio Widget
add_action( 'elementor/query/my_custom_filter', function( $query ) {
    // Get current meta Query
    $meta_query = $query->get( 'meta_query' );

    // If there is no meta query when this filter runs, it should be initialized as an empty array.
    if ( ! $meta_query ) {
        $meta_query = [];
    }

    // Append our meta query
    $meta_query[] = [
        'key' => #no idea what value there
        'value' => [ 'lifestyle', 'promotion' ],
        'compare' => 'in',
    ];
    $query->set( 'meta_query', $meta_query );
} );

Can u help me with query please?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda