0
votes

I'm developing a plugin that creates custom wordpress pages, however I ran into a problem when trying to get shortcodes from other plugins to integrate into my plugin, well more like I couldn't find any info on it.

For example if someone uses my custom page builder and adds a short code [gallery] that is associated with an enabled plugin, I want the shortcode to do it's thing.

Could anyone point me in the right direction for this?

3
I think this previous topic would help: stackoverflow.com/questions/9820190/… - Chizzle

3 Answers

0
votes

Try wordpress

http://wordpress.org/plugins/synved-shortcodes/

while this plugin let's you integrate shortcodes on every wordpress page , I suppose that you issue is with wordpress functions.php file where you can have a look at , with this plugin installed !

0
votes

You can check if a shortcode exist before printing it with the function shortcode_exists() (https://codex.wordpress.org/Function_Reference/shortcode_exists)

Example:

<?php
if ( shortcode_exists( 'gallery' ) ) {
    // The [gallery] short code exists.
}
?>

Then, if it exist and you want to print that shortcode with PHP code you should use do_shortcode() function (https://developer.wordpress.org/reference/functions/do_shortcode/)

Example:

<?php echo do_shortcode('[gallery]); ?>
0
votes

Always use in WordPress's in-built

the_content

hook to print your custom page content.

WordPress by default process all shortcodes before outputting any stuff from this hook.

More info can be found here: https://codex.wordpress.org/Function_Reference/the_content