Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.