• Resolved mychildren2020

    (@mychildren2020)


    Hi,

    How to run a code snippet in a specific page or at a specific place in a page? How to make sure it will not run at other places? Can a shortcode help? If yes, how to create a shortcode using Code Snippet plugin? Please help…

Viewing 1 replies (of 1 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    Absolutely, a shortcode might help if you have some content to output.

    Here’s how you might do that:

    add_shortcode( 'shortcode_name', function () {
    	ob_start();
    
    	// do output here
    
    	return ob_get_clean();
    } );

    Once added, you can use [shortcode_name] in your posts and pages.

Viewing 1 replies (of 1 total)
  • The topic ‘Run a code snippet in a specific page or at a specific place’ is closed to new replies.