Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!