2

Suppose I have content like

[xxx]
Here is some content in xxx 
[/xxx]

Here is content outside xxx ...

Can I somehow just get

  1. content inside [xxx] ONLY
  2. content outside [xxx] ONLY
3

Depends on the shortcode. If you have access to the shortcode's handler function, that function's second argument is the content inside the shortcode:

function wpse20136_shortcode( $atts, $content ){
  // $content has the content inside xxx
}

register_shortcode( 'xxx', 'wpse20136_shortcode' );

For getting all content not in shortcodes, that's easy. strip_shortcodes() does that:

strip_shortcodes( get_the_content() );

for example, will give you the content of the current post with only the content not inside shortcodes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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