Support » Plugin: Elementor Custom Skin » Elementor Custom Skin + custom query filter

  • Hi!
    I install your plugin, it’s great.
    Now I must order my post by meta_value, so in function.php I wrote:

    add_action( ‘elementor/query/get_query_args/archivio_filter’, function( $query ) {

    $query->set( ‘post_type’, ‘archivio’ );
    $query->set(‘orderby’, ‘meta_value’);
    $query->set(‘meta_key’, “Anno”);
    } );

    I recive the notice: “Notice: elementor_pro/query_control/get_query_args/current_query รจ deprecata dalla versione 2.5.0! Utilizzare al suo posto use: elementor/query/get_query_args/current_query. in /wp-includes/functions.php on line 4711”

    So I wrote to Elementor support and they say:

    “This error indicates that you have a theme or plugin that is using elementor files that are out of date. Please bring all of your WordPress installed themes and plugins up to date.”

    I use Oceanwp, the last WordPress version and everything is updated.

    Is it possible that there is incompatibility with Elementor Custom Skin or am I doing something wrong?

    Thanks for your support,
    regards.

Viewing 1 replies (of 1 total)
  • Hello friend, this code worked for me. I couldn’t figure out how to do it using elementor visually. But you can just add this to your theme function. Something like that would work.

    You want to use the pre-get post which runs before the query gets printed.

    https://www.advancedcustomfields.com/resources/orde-posts-by-custom-fields/

    
    function my_pre_get_posts( $query ) {
    	
    	// do not modify queries in the admin
    	if( is_admin() ) {
    		
    		return $query;
    		
    	}
    	
    	// only modify queries for 'event' post type
    	if( isset($query->query_vars['post_type']) && $query->query_vars['post_type'] == 'events' ) {
    		
    		$query->set('orderby', 'meta_value');	
    		$query->set('meta_key', 'Anno');	 
    		$query->set('order', 'Asc'); 
    		
    	}
    	
    	// return
    	return $query;
    
    }
    
    add_action('pre_get_posts', 'my_pre_get_posts');
    

    Good luck!
    Giovani Camara,
    https://giovanicamara.com

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.