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 )
    {
        return;
    }

    if ( is_singular() )
    {
        $done = TRUE;
    }

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

Result

enter image description here

error code: 523