Hi there,
This is my first attempt to create a shortcode on my own. And I unfortunately do not find what is wrong.
This one is working properly:
add_shortcode( 'sc_my_text', 'my_text' );
function my_text( $atts ) {
return "my text";
}
But this one not:
add_shortcode( 'sc_my_text', 'my_text' );
function my_text( $atts ) {
return "<a href="https://mywebsite.com">my text</a> </p>
my additional text";
}
Could you please give me a hint how to get a link into this text? Couldn’t find this in the documentation…
Thank you!
Hey mai,
Here is an article for you:
https://www.wpbeginner.com/wp-tutorials/how-to-add-a-shortcode-in-wordpress/
If you need further assistance please let us know.
Best regards,
Victoria
Hi Victoria,
Thank you for the link which I carefully read (among many others I had googled myself). But this still does not help. Can you confirm if it is possible to include a link with HREF in a shortcode? Or is this simply not possible?
Thank you!!!
Hi mai,
It is possible, it just should be a valid string. What you have up there does not look correct.
Best regards,
Victoria
Hi Victoria,
Thanks for your efforts. I tried again very hard, but still do not understand where the code is wrong. I’ll solve this otherwise. Please close the ticket.
Best regards
Hi,
If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon