Page builders can make life easy when designing and building pages in WordPress. They allow users to get up and running fast with no programming knowledge required.
Using the shortcode
The shortcode in the WPGetAPI plugin is compatible with all major page builders and can be used like any other shortcode, simply place it where you want the output displayed.
We have tested the shortcode with Elementor, WPBakery Page Builder, Visual Composer, Beaver Builder and Divi. Our shortcode will work in any page builder that accepts shortcodes.
Here we have used Elementor builder to display API shortcode. The results above look strange as this is the raw JSON string that the API returns. View our tutorial on how to format API data to HTML if you want to easily make this look prettier.
Using the template tag
If your API returns complex data, or you need to format your data in a particular way, then you will most likely need to use the template tag method of outputting data. This poses a problem when using page builders as it is difficult to inject PHP code snippets into your page layout when using these builders.
The best solution we have found to overcome this is to use a PHP code snippets plugin, such as this one – https://wordpress.org/plugins/code-snippets/
This plugin allows you to create a code snippet and then you can insert this snippet into your page as a shortcode, essentially turning any PHP code into a shortcode. We aren’t affiliated with this plugin in any way, but we have tested it and it works great as a way to insert PHP code into a WordPress page builder page.