Function to show only first instance of shortcode

Add a static variable to the shortcode handler to check if the shortcode has been called already.

Sample code

add_shortcode( 'wpse62826', 'wpse_62826_shortcode' );

function wpse_62826_shortcode()
    static $done = FALSE;

    // Nothing to do.
    if ( $done )

    if ( is_singular() )
        $done = TRUE;

    return '<b>I run once on singular views!</b>';


enter image description here