I tried to write a very basic plugin, taking information from the net. For the moment I am yet to add any proper code, and first I was checking if things were working. I found its not working, both of the below functions failed to load.
Both eo.php (the file with the following codes) and eos.css are in the same folder : wp-content/plugins/eo/
if( !function_exists('eo')){
function eo($text) {
$text = str_replace('Test', 'Best', $text);
return $text;
}
add_filter('the_content', 'eo');
}
if( !function_exists('eos')){
function eos( ){
wp_register_style( 'eo', plugins_url('eo/eo.css', __DIR__) );
wp_enqueue_style( 'eo' );
}
add_action( 'wp_enqueue_scripts', 'eos' );
}
And then question, can I load a js file along with like this ?
if( !function_exists('eos')){
function eos( ){
wp_register_style( 'eo', plugins_url('eo/eo.css', __DIR__) );
wp_register_script( 'eojs', plugins_url('eo/eo.js', __DIR__) );
wp_enqueue_script( 'eo' );
wp_enqueue_script( 'eojs' );
}
add_action( 'wp_enqueue_scripts', 'eos' );
}
Any help will be welcomed
Thanks a lot :)