mardi 23 février 2016

Wordpress add_filter after post

I'm trying to add custom plugin after single post content. I have tried with add_filter and add_action to get my plugin printed out.

     if(!defined('ABSPATH')) exit;

 function customPlug_plugin_install()
 {

 }

 register_activation_hook(__FILE__, 'customPlug_plugin_install');

 function customPlug_plugin_scripts()
 {
    wp_register_script('customPlug_script', plugin_dir_url(__FILE__), 'js/customplug.js', '1.0', true);
    wp_register_script('customPlug_bootstrap_script', plugin_dir_url(__FILE__), 'js/customplug.js', '1.0', true);
    wp_register_script('customPlug_script', plugin_dir_url(__FILE__), 'js/customplug.js', '1.0', true);
    wp_enqueue_script('customPlug_script');
 }


 function my_plugin($content) {
    $content = "Custom Plugin Content";
    return $content;
 }
 add_action('the_content', 'my_plugin');

However, this is just returning either the plugin content, or the_content if I comment out add_filter or add_action



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire