WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a PHP-Code for Slider which I found. Now I want to transform it into a Wordpress shortcode.

Here's the Code:

<!-- Slider -->     
        <div class="big-slider-wrapper block-full block-h-3">
            <div class="big-slider" id="big-slider"<?php echo ($timeout?' data-timeout="'.$timeout.'"':'')?>>
                <div class="big-slider-inner">
                    <div class="big-slider-uber-inner">

                        foreach($slider as $slide) {
                            if($checkerboard == 'true')

                                echo '<a href="'.$slide['link'].'" class="big-slider-slide block-3 bg-color-slider'.($flip?' flip':'').(@$slide['video_embed']?' video-slide':'').'">';
                                echo '<div class="big-slider-slide block-3 bg-color-slider'.($flip?' flip':'').(@$slide['video_embed']?' video-slide':'').'">';

                            $pic='<span class="pic block-h-2 no-mar">';
                                    $pic.='<span class="video">'.$slide['video_embed'].'</span>';
                                    $pic.='<img src="'.$slide['bgimage'].'" alt="'.htmlspecialchars($slide['title']).'" /><span class="pic-after"></span>';

                                <span class="text-wrapper">
                                    <span class="text block-h-1">
                                        <span class="text-inner">
                                            <span class="title">'.$slide['title'].'</span>
                                            <span class="text-text">'.$slide['description'].'</span>

                                echo $text.$pic;
                                echo $pic.$text;

                                echo '</a>';
                                echo '</div>';


        <div class="clear anti-mar">&nbsp;</div>

        <div class="big-slider-control block-full block-h-half bg-color-slider" id="big-slider-control">
            <a href="#" class="control-left"></a>
            <div class="control-seek">
                <div class="control-seek-box"><div class="control-seek-box-inner"></div></div>
            <a href="#" class="control-right"></a>
            <div class="clear"></div>
        <!-- /Slider -->

I already started with, first I've created the container which looks like this:

function shortcode_slider($atts, $content = null) {
$str = '';
$str .= '<div class="big-slider-wrapper block-full block-h-3">';
$str .= '<div class="big-slider" id="big-slider">';
$str .= '<div class="big-slider-inner">';
$str .= '<div class="big-slider-uber-inner">';
$str .= do_shortcode($content);
$str .= '</div>';
$str .= '</div>';
$str .= '</div>';
$str .= '</div>';
$str .= '<div class="big-slider-control block-full block-h-half bg-color-slider" id="big-slider-control">';
$str .= '<a href="#" class="control-left"></a>';
$str .= '<div class="control-seek">';
$str .= '<div class="control-seek-box"><div class="control-seek-box-inner"></div></div>';
$str .= '</div>';
$str .= '<a href="#" class="control-right"></a>';
$str .= '<div class="clear"></div>';
$str .= '</div>';

return $str;


add_shortcode('slider', 'shortcode_slider');

But now I am hanging with the nested shortcode to create, since I am not experienced PHP or WordPress coder.

share|improve this question
First, why do you need a nested shortcode? What is it supposed to do? Why can't the shortcode you already have to the work? – s_ha_dum Mar 16 '13 at 15:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.