-1

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?

1 Answer 1

-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;
1
  • 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
    Commented Sep 2, 2012 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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