Skip Navigation

[Resolved] Visual composer rows showing in filtered views

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

Problem: After updating search results with AJAX, I see Visual Composer shortcodes written on the page instead of being rendered.

Solution: Add the following code to functions.php:

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

Relevant Documentation: https://toolset.com/documentation/user-guides/views-pagination/

0% of people find this useful.

This support ticket is created 7 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 10 replies, has 2 voices.

Last updated by stewartE 7 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#539572

I am having some issues with I think the latest version of toolset.

The issue is that I have created a view which displays a content type called item. I filter the items using parametric search. I have created the template for this view using visual composer. I've done this lots of times before with no probs.

The first issue is that the filters work but they are showing the visual composer short codes on the front end once the parametric select is used i.e something like this shows on the front end

[vc_row][vc_column][vc_column_text][wpv-view name="view-name"][/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]I am text block. Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.[/vc_column_text][/vc_column][/vc_row]

#539730

Hi does this View update using AJAX? If so, there is a function you must add to your functions.php file to interpret these shortcodes after the View updates:

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

If you add the code directly to your theme's functions.php file, automatic updates to your theme in the future will wipe out this code. This is why it's important to use a child theme. More information about that here:
https://codex.wordpress.org/Child_Themes

Please add this code and let me know the results.

#541334

Hi - I've never had to add this to my functions.php file before it has always just worked. This suggests to me that it is a bug introduced after the last update? Looking at the forum there seems to be lots of similar tickets.

Can I please request that this be fixed in the next update rather than me having to create child theme, add to function.php etc.

The Visual Composer compatibility that you added a while back was extremely useful functionality

#541550

Can I please request that this be fixed in the next update rather than me having to create child theme, add to function.php etc.
First, I need to be sure I've found the actual problem and there's no other solution. Would it be possible for me to create a clone of your site so I can run some tests locally? If that's okay with you, please provide wp-admin login credentials here in the private reply fields. I'll use the Duplicator Pro plugin to create a clone and run tests without affecting your live site.

I'll verify the solution works and we can go from there. Thanks!

#542613

As I suspected, this code resolves the issue:

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

Please create a child theme and add it to your child theme's functions.php file. As far as why this worked up until now, I'm not exactly sure. I can think of at least two reasons:
- Your search results were not updated with AJAX before, so it wasn't necessary
- This code was added to your theme before, but it was overwritten by a theme update

Can you tell me exactly which plugins you updated, and what the old versions were? What about the theme, when was the last time it was updated? If it's a bug I could try to replicate it, but I don't really think that's the case here. Adding this code should resolve it.

#544194

Its a brand new dev website. So most uptodate version of everything. I've not added this code to anything before for it to be overwritten. Could it be something the theme developers have changed? It is The7 theme which is one of the top sellers on Themeforest (third highest seller I think)

I'm worried because I am using Toolset with this theme on a least ten websites. They almost all use views and visual composer in the theme templates. Which could be a nightmare if I update something and this happens?

#544321

I'm worried because I am using Toolset with this theme on a least ten websites. They almost all use views and visual composer in the theme templates. Which could be a nightmare if I update something and this happens?

I see how that would be worrisome. However, if the code I recommended resolves the problem, then Toolset is working as expected. Shortcodes are not expected to be executed after an AJAX update. This is documented on our site, and is not a new behavior. See "Limitations of using AJAX Pagination" on this document:
https://toolset.com/documentation/user-guides/views-pagination/

If you have other sites where shortcodes are executed in AJAX updates, then my guess is that those sites have this WPBMap code added somewhere - it's Visual Composer code that helps handle shortcodes. May I see another site example where shortcodes are executed in AJAX update results? I can investigate and help clear this up a bit more.

#544338

Great thanks - can you activate private messages and i'll send you the details

#544340

Private reply fields are enabled now.

#544398

I wonder in your opinion is this a shortcoming with the theme that I should bring up with them - In your experience do most (premium) themes have this added in the code?
I don't think it's a shortcoming in the theme, it's just a requirement when Toolset displays search results using AJAX, and those search results include shortcodes generated by Visual Composer. You will see the same issue with other themes that utilize Visual Composer, and there are several other tickets on the forum related to this issue:
hidden link..69i57j69i58.8045j0j7&sourceid=chrome&ie=UTF-8

#544788

Ok thanks