Add text before a shortcode

I have a shortcode that I run on a page template
echo do_shortcode('[product_category category="model-downloads"]');
which is fine, but I heed to be able to put a static body of text before it, something like this
"All the files contained below are for personal use only"
[Shortcode]

everything I've tried so far has brought up an error and crashed the plugin. Does anyone know how I can add the text in before the shortcode

  • Alex Stine

    Hello,
    Hope you are well.

    Could you please try this modified PHP code? It should achieve your goal.

    echo
    '<p class="text-before-shortcode">All the files contained below are for personal use only</p><br>'
    .do_shortcode('[product_category category="model-downloads"]');

    I gave you a CSS class to style the text before the shortcode, you can use the class like this.

    .text-before-shortcode {
    /*Styles go here*/
    font-size: 14px;
    color: black;
    font-weight: bold;
    }

    Please let me know if this works for you.

    Cheers,
    Alex :smiley:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.