title: Return only the shortcode from post?
body: <p>Is it possible to filter out only the shortcode from the post and then run the shortcode?</p>
  
  <p>My page looks like this:</p>
  
  <pre><code>[summary img="images/latest.jpg"]
  
  This here is the summary
  
  [/summary]
  
  Lots of text here...
  </code></pre>
  
  <p>And i just want to display the shortcode on a specific page.</p>
  
  <p>Tried using regular expressions, but they dont seem to work:</p>
  
  <pre><code>$the_query = new WP_Query('category_name=projects&amp;showposts=1');
  
      //loop
      while ( $the_query-&gt;have_posts() ) : $the_query-&gt;the_post();
          echo '&lt;b&gt;';
          the_title();
          echo '&lt;/b&gt;';
          echo '&lt;p&gt;';
  
          $string = get_the_content();
  
          if (preg_match("[\\[[a-zA-Z]+\\][a-zA-Z ]*\\[\/[a-zA-Z]+\\]]", $string , $matches)) {
              echo "Match was found &lt;br /&gt;";
              echo $matches[0];
          }
  
          echo '&lt;/p&gt;';
      endwhile;
  </code></pre>
  
  <p>Any idéas?</p>
  
  <p>EDIT:</p>
  
  <p>Found a temporary solution.</p>
  
  <pre><code>while ( $the_query-&gt;have_posts() ) : $the_query-&gt;the_post();
  
      $content = str_replace(strip_shortcodes(get_the_content()),"",get_the_content());               
      echo do_shortcode($content);
  
  endwhile;
  </code></pre>
  
  <p>I saw that wordpress had a function for striping shortcodes but not for strip content. So i replaced the stripped content string from the whole post to get just the shortcode. The only bad thing about this that the shortcodes have to be in the beginning of the posts.</p>