Activate short codes for all post queries?

There is a way to apply that to all post content. function sc_all_content_wpse_137734($posts) { foreach ($posts as &$p) { $p->post_content = do_shortcode($p->post_content); } return $posts; } add_filter(‘the_posts’,’sc_all_content_wpse_137734′); I would suggest that this is a very, very good way to break things. Plugins and themes will not expect shortcodes to be rendered that early, and the … Read more

Space in WordPress Attribute Causing Problems

The way your code is written, you are breaking your div tag over several lines– literally like this, if you look at the generated source: <div class=”Container-Caption” alt=”Oh I have been to Ludlow Fair” rel=”http://www.link.com”> blah</div> I do not see any different between using a caption with or without spaces, but breaking your tag like … Read more

How to display data from custom fields in my custom shortcode?

You simply need to query your custom fields and return them with your shortcode: // EXAMPLE USAGE: // [loop the_query=”showposts=100&post_type=page&post_parent=453″] function custom_query_shortcode($atts) { // Defaults extract(shortcode_atts(array( “the_query” => ” ), $atts)); // de-funkify query $the_query = preg_replace(‘~&#x0*([0-9a-f]+);~ei’, ‘chr(hexdec(“\\1″))’, $the_query); $the_query = preg_replace(‘~&#0*([0-9]+);~e’, ‘chr(\\1)’, $the_query); // query is made query_posts($the_query); // Reset and setup variables $output=””; … Read more