Shortcode inside shortcode (displaying text and shortcode - error)

Discussion in 'WordPress' started by brandon93s, Aug 14, 2012.

  1. #1
    I have developed a custom short code, and am trying to get it to display the content of a child shortcode without actually outputting the text as well.

    My shortcodes are as follows:

    [member]
    
    [gravityform id="1" name="Order Form" title="false" ajax="true"]
    
    [/member]
    Code (markup):
    and my PHP function is as follows:
    
    add_shortcode( 'member', 'member_check_shortcode' );
    
    function member_check_shortcode( $atts, $content = null ) {
    	 if ( is_user_logged_in() && !is_null( $content ) && !is_feed() )		
    return $content.do_shortcode($content);
    	return '';
    }
    PHP:
    My output is 1/2 successful. It is displaying the contact form as it is supposed to.. however, it is also displaying the inside shortcode as plain text above it! I need only the form displayed.. not the tag that is including it. There must be something wrong with my function but i'm not sure exactly what.

    EDIT:: Once again, solved my own issue. The if statement should return:
    return $content.do_shortcode($content);
    PHP:
     
    brandon93s, Aug 14, 2012 IP
  2. superrichguy

    superrichguy Well-Known Member

    Messages:
    2,225
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    195
    #2
    It looks like it works fine? I don't see a prob???
     
    superrichguy, Aug 14, 2012 IP
  3. brandon93s

    brandon93s Active Member

    Messages:
    798
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
    #3
    Yes, my above edit fixed the issue. Thanks.
     
    brandon93s, Aug 14, 2012 IP
  4. superrichguy

    superrichguy Well-Known Member

    Messages:
    2,225
    Likes Received:
    78
    Best Answers:
    0
    Trophy Points:
    195
    #4
    Oh, sorry about that. Was reading toooooo fast and didn't notice the edit below it...
     
    superrichguy, Aug 14, 2012 IP