Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Im trying to wrap a shortcode inside of a "user loggeed in" shortcode. Here are the two shortcodes and my setup in WYSIWYG

function wpfc_logged_in( $atts, $content = null ) {
    if (is_user_logged_in() )
      {
        return do_shortcode($content);
      }
}

add_shortcode('loggedin', 'wpfc_logged_in');


function info_box( $atts, $content = null  ) {
        extract( shortcode_atts( array(
        'type' => 'tip',
        'icon' => ''
    ), $atts ) );  
    $return = '<div id="info-box"><div class="info-box '.$type.'"><p>'.$content.'</p><a href="#" class="info-close-icon"></a></div></div>';
    return $return; 
}
add_shortcode('info_box', 'info_box');

WYSIWYG:

[loggedin]
[ info_box type='setting' ]content text[ /info_box]
[/loggedin]
share|improve this question

closed as too localized by toscho Feb 14 '13 at 19:51

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

up vote 1 down vote accepted

it looks like you have extra spaces in your shortcodes.

Try

[loggedin]
[info_box type='setting']content text[/info_box]
[/loggedin]

instead of

[loggedin]
[ info_box type='setting' ]content text[ /info_box]
[/loggedin]
share|improve this answer
    
Holy cow! Thank you lolz. I have to wait 3 mins to accept the answer. Ugh this was driving me nuts! –  Aliyah Feb 14 '13 at 19:41
    
ok great, so your code was fine after all ;-) –  birgire Feb 14 '13 at 19:48

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