Skip Navigation

[Resolved] Visual composer issue

This thread is resolved. Here is a description of the problem and solution.

Problem: I'm seeing Visual Composer shortcodes written onto the page when I update a View using AJAX.

Solution: Add the following custom code to help display shortcodes from Visual Composer more effectively after an AJAX update:

/* --------------------------------------------- */
// VC RENDER SHORTCODES AFTER AJAX
add_action('init', 'add_mapped_shortcodes_on_init');
function add_mapped_shortcodes_on_init()
{
  WPBMap::addAllMappedShortcodes();
}

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 2 replies, has 2 voices.

Last updated by Simone 2 years, 10 months ago.

Assigned support staff: Christian Cox.

Author
Posts
#571287

Hi, I created a view with a custom search.
hidden link
hidden link
The template of the results is created using Visual Composer.

On the page loading there are already shown some results, correctly.
After changing some filed in the search, everything is messing out

Why?

#571456

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

That's most likely because you're using AJAX to update the results. Try adding this code to your functions.php file to cause Visual Composer shortcodes to be rendered for AJAX updates:


/* --------------------------------------------- */
// VC RENDER SHORTCODES AFTER AJAX
add_action('init', 'add_mapped_shortcodes_on_init');
function add_mapped_shortcodes_on_init()
{
  WPBMap::addAllMappedShortcodes();
}
#571468

Working now!
Thanks