Skip Navigation

[Résolu] Loop Item in View returns html code when filtered with search/filters

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: Visual Composer shortcodes are not being interpreted when search results are updated using AJAX filters. Shortcodes are being written out in HTML instead of being processed and replaced.

Solution: Add the following code to your functions.php file:

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

Relevant Documentation: N/A

This support ticket is created Il y a 7 années et 2 mois. 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 3 réponses, has 2 voix.

Last updated by Brent Urbanski Il y a 7 années et 2 mois.

Assisted by: Christian Cox.

Auteur
Publications
#489257
View Loop Editor.png
Screen Grab 2.png
Screen Grab 1.png

I am trying to: Use Visual Composer to stylize the Content Template used in single loop item in a View

I visited this URL: Sorry I cannot share a link. I'm developing locally.

I expected to see: The loop items look great when no filters are applied (see screen grab 1)

Instead, I got: As soon as the query is filtered, I see the code used in the Content Template (see screen grab 2). Can you tell me why this is happening? Am I unable to use Visual Composer to design the layout of my Content Template in this case?

#489272

Hi Brent, I assume you are using AJAX to update your search results when you add a filter, correct? If so, the reason you are seeing shortcodes is that typically shortcodes only get interpreted on first page load. When you use AJAX to modify your results after the page is initially loaded, the shortcodes for VC don't get rendered automatically.

Fortunately there is a workaround for this. You can tell VC to render your shortcodes before they get displayed by adding the following code to your theme's functions.php file:

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

Another option would be to not use AJAX to update your results when you modify filters.

Please let me know if one of these solutions will work for you.

#489305

Christian,

You rock! The function you provided works like a charm. I appreciate your help.

Thanks,
Brent

#491143

Hi Christian,

I hope you can help me with a similar issue. I've installed the css3 animation plugin 'Animate It!' and have added animation shortcodes to my Views Loop Output Editor bootstrap grid. The animations work will upon initial page load, but once I apply a view filter all of the entries/posts disappear. Any ideas as to what is causing this issue?

Thanks,
Brent

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.