is there any plugin that will add new quicktag, says:

[hidetext]some text to hide[/hidetext]

and any text inside those tag is hidden from frontpage/archive/etc. It only shown on single post page.

link|improve this question

feedback

2 Answers

up vote 2 down vote accepted
add_shortcode( 'hidetext', 'my_hidetext_shortcode' );
function my_hidetext_shortcode( $atts, $content = '' ) {
    if( is_single() )
        return $content;
    else
        return;
}

Docs: add_shortcode(), is_single()

Solution is untested.

link|improve this answer
feedback

A slight modification on the function above. You'll want to use is_singular('post') instead, unless you also want to target other areas

add_shortcode( 'hidetext', 'rkv_hidetext_shortcode' );

function rkv_hidetext_shortcode( $atts, $content = null) {
    if( is_singular('post') )
        return $content;
    else
        return;
}

tested and works.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.