Shortcodes output in the wrong order

the_time() is the problem here. It echoes its output. Shortcodes, effectively, happen in this order: The text containing shortcodes is parsed to find shortcodes. Each shortcode is executed and its output stored. Each shortcode is replaced with its output. The problem is that if you echo inside a shortcode, its output will be printed to … Read more

passing multiple parents value into a shortcode

If you’re passing in a comma-delimited list of parent IDs when you call the shortcode, it’s pretty easy to turn this to an array. For example, using [scname parent=”5,10,15″]: function andrew_child_loop_shortcode_new ( $atts ) { global $post; $thePostID = $post->ID; $atts = shortcode_atts( array( ‘posts’ => 20, ‘parent’ => $thePostID ), $atts ); // Turn … Read more

Creating a Slider Shortcode Based on Nivo Slider

that’s will be nested shortcodes, so you will need [slider] and [image] shortcode add_shortcode( ‘nivo_slider’, ‘nivo_slider_func’ ); function nivo_slider_func( $atts, $content = null ) { $output=”<div class=”slider-wrapper theme-default”>”; $output .= ‘<div id=”slider” class=”nivoSlider”>’; $output .= do_shortcode($content); $output .= ‘</div></div>’; return $output; } add_shortcode( ‘image’, ‘nivo_image_shortcode’ ); function nivo_image_shortcode( $atts, $content = null ) { extract( … Read more

Is it possible to make shortcodes NOT case sensitive?

Here is another simple idea for a case-insensitive shortcode: /** * Make a shortcode case insensitive via the the_content filter * * @param string $content * @return string $content */ function my_case_insensitive_shortcode( $content ) { $sc=”test”; // Edit this shortcode name to your needs $from = ‘[‘. $sc ; $to = $from; if( stristr( $content, … Read more

Change font-size within a shortcode

Are you trying to put a shortcode within a shortcode? Perhaps this is an easier solution to control your front-end output? CSS span.my_pixel_size{font-size:25px;} PHP ‘<p>This is the content: <span class=”my_pixel_size”>’ . $content . ‘</span></p>’;