WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently building a plugin to display specific part of post after accepting verification code. Can a shortcode return a part of a post? I mean:

Bla bla bla [shortcode postID="100"] Special bla bla [/shortcode] Bla bla

How to code a function to retrieve specific content of a post only when the plugin calls this shortcode?

share|improve this question

Why don't you use something like:

Bla bla bla [shortcode postID="100" content="Special bla bla"] Bla bla

and then retrieve your content in your shortcode function.

extract( shortcode_atts( array(
   'content' => '',
), $attr ) );

echo 'special content is: '.$content;
share|improve this answer
I meant something different. Shortcode will be used to receive large texts, only 2-3 paragraphs will be available outside shortcode. All the styling etc. would be gathered from database within shortcode. – Peter Sep 2 '12 at 18:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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