Home Wordpress: shortcode in plugin is rendered after jquery
Reply: 0

Wordpress: shortcode in plugin is rendered after jquery

Jefferey Le Clous
1#
Jefferey Le Clous Published in 2018-02-14 11:22:27Z

I'm using wpbb to create a plugin. The plugin adds a shortcode and I would like to add manipulation to the content the shortcode is returning.

in class-testuy-public I added the following function

public function x_register_shortcodes() {

        function foobar_func(){

            require_once 'partials/testuy-public-display.php';
            return;

        }
        add_shortcode( 'foobar', 'foobar_func' );
    }

In class-testuy I add the following script to define_public_hooks function:

private function define_public_hooks() {

        $plugin_public = new Testuy_Public( $this->get_plugin_name(), $this->get_version() );


        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
        $this->loader->add_action( 'init', $plugin_public, 'x_register_shortcodes' );

    }

The content is in partials/testuy-public-display.php but is rendered after jquery so when I try to use jquery on the content it doesn't work.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.358125 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO