I make a plugin that when entering a shortcode should display a slider. How to make html output correctly? Just attach a function to the shortcode that will return all the code?

function slider(){ return "<html> etc </html>"; } add_shortcode( 'shortcode1', 'slider' ); 

Or is there a more adequate way?

    1 answer 1

    The method you cited is standard for WordPress. Therefore, it is necessary to use it.

    By the way, in this way in themes and plugins, if not all, then almost all shortcodes are created.