Get ID of post or page ASP shortcode is on and use in asp_query_args meta filter

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Get ID of post or page ASP shortcode is on and use in asp_query_args meta filter

This topic contains 2 replies, has 2 voices, and was last updated by Menzer92 Menzer92 2 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #25398
    Menzer92
    Menzer92
    Participant

    Hi I have an ajax search pro shortcode inserted in on a post page and I need to grab the post page id variable and insert it in the meta value below, is there a way to do this…. I assume this would be done via javascript code/variable but I cannot find the code for it. I have inserted the code I am working with. Everything filters nicely if I manually enter the post ID but I would like it to be the post variable. I tried global $post, get_query_object_id(), get_the_ID() but nothing works

    function asp_query_args_change($args, $search_id) {	
             if($search_id == '4'){
    
    	$args['post_meta_filter'] = array(
       	      array(
                    	'key'     => '_EventOrganizerID',
        	                'value'   => 41069, <------- <strong>This is the post page the shortcode is inserted on</strong>
        	                'operator' => '='
             ),
    		
    	);
    
    	}
      return $args;
    }
    #25404
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    Sure, this variable should hold the current page ID:

    $args['_page_id'];

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #25412
    Menzer92
    Menzer92
    Participant

    You are the Boss!!! Thank you soooo much!!!!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.