Skip Navigation

[Resolved] Visual Composer + AJAX Filters

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 7 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Beda 7 years, 3 months ago.

Assisted by: Beda.

Author
Posts
#564517

Whenever Visual Composer is used inside views, alongside AJAX search filters (hidden link) -- then the official response from WP Types has been "this is unsupported" -- because the admin-ajax.php file returns a string of raw, uninterpreted visual composer shortcodes as the AJAX response.

I searched through many threads and they all had that same "official" response. However, someone posted this little bit of code that fixes the problem for me:

if ( is_admin() ) {
add_action('init', function() {
WPBMap::addAllMappedShortcodes();
});
}

I hope you guys integrate this little bit of code into WP Types and save a lot of people a lot of headache.

#564686

I am aware of this issue, and as far I know it is not entirely due to Toolset.

To be sure we speak about the same issue, please check this ticket:
https://toolset.com/forums/topic/visual-composer-image-grid-not-showing/

VC tries to render the grid short codes via an AJAX call, which assumes that the grid ID is stored in a post meta, attached to the current page.
While, when using VC with Content Templates, the grid ID is saved with Content Templates's post meta.

So, it requires to hijack the AJAX call and replace the ID with a correct ID of the attached content template.

The main problem here is that VC stores some modules data in the relevant post postmeta.

When a Content Template uses VC, it follows the same pattern: the grid metadata is stored in the Content Template postmeta.
However, when rendering the post in the frontend, the current post (and this is also the one that gets passed on AJAX operations like this one to render a grid) is supposed to store that postmeta data, which it does not.

So, long story short, when using VC on a Content Template, some VC modules require that the current post they manage is the actual current post (for example, on modules for post author, etc etc), and other modules require that the current post is the Content Template involved (like this grid one).

Each module has its own data and rendering management, so what we will need here is a filter on that current post ID on at least all the modules that store and work over data stored in the Content Template.

We are aware of the issues and we are trying to find the best solution together with VC.

The forum ‘Types Community Support’ is closed to new topics and replies.