Reply To: Visual Composer Integration


Ernest Marcinko


I have looked into it more, I might have found a possible solution, but it might not work as expected. The fact that the post grid gets the items via ajax, makes this far more complicated.
Please keep in mind that this is far beyond regular support, so I cannot guarantee it’s going to work.

First, open up the \wp-content\plugins\js_composer\include\classes\shortcodes\vc-basic-grid.php file and scroll to line 485, which should be this:

$query = html_entity_decode( vc_value_from_safe( $this->atts['custom_query'] ), ENT_QUOTES, 'utf-8' );

..just below that line, put this:

$pu = parse_url($_SERVER["HTTP_REFERER"]);
if ( isset($pu['query']) ) {
  parse_str($pu['query'], $ags);
  if ( isset($ags['qs']) )
    $query = 's='.$ags['qs'];

This will attempt to parse the referrer url, and if the “qs” query argument is set, then will try to parse it, and pass it to the grid. You can change this to anything, I have choosen “qs” as it will not redirect to the search page automatically.

Then on the ajax search pro General Options -> Behavior panel, change the Redirect to url option to the page where the grid is created and the qs argument. In my case it was page 99, so it became:


Now the search redirects to this page, and the visual composer detects the “qs” argument, and changes the $query variable accordingly.

Ernest Marcinko

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