Plugins/shortcodes not running with ajax
-
Hi! I’m using Ajax Load More to create an infinite scroll of posts and, in each one, I want to use a news ticker (Ditty News Ticker)… And I got a few problems. The first post works fine. When I scroll and ajax injects the other ones, it does not.
First things first: the problem is not EXACTLY with shortcodes, it is with plugins that can be run using shortcodes; and it happens only on the scroll; directly loaded pages works fine. Shortcodes that are registered in my functions.php WORKS. Plugins that works with shortcodes, does not.
This is the function I am using to call the ticker.
<?php if (function_exists('ditty_news_ticker')) { ditty_news_ticker( 1487 ); } ?>
The problem is: the plugin does not seem to get loaded when the ajax content is loaded. Using this code as a test, you can see that it literally says that the function does not exist.
<?php if (function_exists('ditty_news_ticker')) { echo 'ditty_news_ticker() exists! Yay!'; ditty_news_ticker( 1487 ); } else { echo 'ditty_news_ticker() does not exist'; } ?>
Using the shortcode (inside the_content or outside, using do_shortcode), all I get is a plaintext version of the shortcode. I tried that filter that is on FAQ and nothing happened, all the same.
With Shortcodes Ultimate, another plugin, it’s even more bizarre: the shortcode IS executed, but the CSS does not work. It creates the DIVs that are supposed to create columns, but it doesn’t load the CSS that does this.
All of this is being loaded within the_content and/or the repeater templates.
Other plugins (like coauthors, for example) works great.So, that’s what we have. For some reason, plugins+shortcodes doesn’t work when the ajax inject content for the second time.
Searching, I found this: https://www.ads-software.com/support/topic/run-shortcode-inside-ajax-request
This is the most similar issue I found… Maybe that’s a way?
- The topic ‘Plugins/shortcodes not running with ajax’ is closed to new replies.