Hello
I’m using a child theme, and in the function.php of the child theme, I wrote a function to insert a inline image in my text :
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
//create short code to insert molecule.png
function molecule_link_shortcode() {
return '<img src="https://test.mysite.fr/wp-content/uploads/2017/02/molecule.png" alt="" style="border: 0px"/>';
}
add_shortcode('molecule', 'molecule_link_shortcode');
but in my article, the shortcode [molecule] has no effect
any advice?
Rgds
xavier
Hey xavierphilippe,
Try registering the shortcode in the archives page as well.
Best regards,
Jordan Shannon
“registering the shortcode in the archives page” ==> what do you means?
should I enter this code in another .php file of my child theme?
The issue was : I use a child theme, and I registered my new function in function.php of my child theme … but it doesn’t work.
II have to add my new function in the function.php original file … and it works !!
I probably did something wrongly when creating the child theme :-( …
Hi,
Apologies for the late reply.
I am happy that you were able to get this worked out.
Best regards,
Jordan Shannon