Shortcode – WordPress REST API
-
Hello!
I am using WordPress with Vue and so far everything is working smoothly. However, when I tried to implement Instagram Feed Plugin, I am having some troubles.
I am able to retrieve the shortcode equivalent in HTML from the WP REST API, but it seems that the JS code is not being executed.
So far what I have realized is the following:
- I need to have a
do_shortcode
in PHP so the plugin will load the JS files inwp_footer()
; of course, it will also load the feed, and that is not the desired behavior since I want to show it from Vue. - If I mark Enqueue JS file in head, it actually loads everything in
wp_head()
, not the desired behavior since I would like to load all the JS files inwp_footer()
, but if this is the only way to load the JS files without callingdo_shortcode
in PHP, it is ok. - Even loading the JS files “correctly” (in
wp_head()
), it seems that the plugin is not calling the AJAX function to load the feed. It is showing me the preloading icon without retrieving the images. - Forcing the
div
that contains the shortcode to reload, gives me the following error:jQuery(...).sbiOwlCarousel is not a function
. - Forcing the
div
that contains the shortcode to reload and callingdo_shortcode
from PHP (and if I call it, it loads the JS files automatically), do not give me any error. - The tow previous points make me think that the Enqueue JS file in head (and without calling the
do_shortcode
in PHP) is not actually loading everything.
So, is there any way to make this happen? Should I call something from Vue? Or maybe add something in the custom JS code option to force the plugin to retrieve the feed?
I will upload the site tomorrow to a public link so I can share it with you guys. In the meantime, here you have a screenshot of the code I am getting from the WP REST API:
Thank you in advance!
- This topic was modified 5 years, 6 months ago by .
- This topic was modified 5 years, 6 months ago by .
- This topic was modified 5 years, 6 months ago by .
- This topic was modified 5 years, 6 months ago by .
- This topic was modified 5 years, 6 months ago by .
- This topic was modified 5 years, 6 months ago by .
- This topic was modified 5 years, 6 months ago by .
- This topic was modified 5 years, 6 months ago by .
- This topic was modified 5 years, 6 months ago by .
- I need to have a
- The topic ‘Shortcode – WordPress REST API’ is closed to new replies.