Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1221757

    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!

    #1221838

    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

    #1221874

    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!!!

    #1222780

    Hi mai,

    It is possible, it just should be a valid string. What you have up there does not look correct.

    Best regards,
    Victoria

    #1222816

    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

    #1222838

    Hi,

    If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘How to create a new shortcode for text including a link’ is closed to new replies.