• Resolved byjuststar

    (@byjuststar)


    Hello: I am using code

    <?php if( $theme_usage == 'all' || $theme_usage == 'coupons' ): ?>
                        					<li class="<?php echo $subpage == 'my_coupons' ? 'active' : '' ?>">
                        						<a href="<?php echo esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'my_coupons' ), array( 'all' ) ) ); ?>">
                        							<h4><?php _e( 'My Coupons', 'couponxl' ) ?></h4>
                        							<p><small><?php _e( 'Check here coupons you have submitted or add new one', 'couponxl' ) ?></small></p>
                        						</a>
                        					</li>
                                        <?php endif; ?>
                                        <?php if( $theme_usage == 'all' || $theme_usage == 'deals' ): ?>
                        					<li class="<?php echo $subpage == 'my_deals' ? 'active' : '' ?>">
                        						<a href="<?php echo esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'my_deals' ), array( 'all' ) ) ); ?>">
                        							<h4><?php _e( 'My Deals', 'couponxl' ) ?></h4>
                        							<p><small><?php _e( 'Check here deals you have submitted or add new one', 'couponxl' ) ?></small></p>
                        						</a>
                        					</li>
                                        <?php endif; ?>

    I am need shordcode:

    <?php echo do_shortcode('[private role="administrator"]Text for Administrators[/private]') ?>

    And I am need working code:

    <?php echo do_shortcode('[private role="administrator"]' , '
    <?php if( $theme_usage == 'all' || $theme_usage == 'coupons' ): ?>
                        					<li class="<?php echo $subpage == 'my_coupons' ? 'active' : '' ?>">
                        						<a href="<?php echo esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'my_coupons' ), array( 'all' ) ) ); ?>">
                        							<h4><?php _e( 'My Coupons', 'couponxl' ) ?></h4>
                        							<p><small><?php _e( 'Check here coupons you have submitted or add new one', 'couponxl' ) ?></small></p>
                        						</a>
                        					</li>
                                        <?php endif; ?>
                                        <?php if( $theme_usage == 'all' || $theme_usage == 'deals' ): ?>
                        					<li class="<?php echo $subpage == 'my_deals' ? 'active' : '' ?>">
                        						<a href="<?php echo esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'my_deals' ), array( 'all' ) ) ); ?>">
                        							<h4><?php _e( 'My Deals', 'couponxl' ) ?></h4>
                        							<p><small><?php _e( 'Check here deals you have submitted or add new one', 'couponxl' ) ?></small></p>
                        						</a>
                        					</li>
                                        <?php endif; ?>
    ' , '[/private]') ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • you might need to ‘assemble’ whatever string you need for within the do_shortcode() function;

    example (untested):

    <?php
    $string = '[private role="administrator"]';
    if( $theme_usage == 'all' || $theme_usage == 'coupons' ):
    	$string .= '<li class="' . ( $subpage == 'my_coupons' ? 'active' : '' ) . '">
    	<a href="' . esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'my_coupons' ), array( 'all' ) ) ) . '">
    	<h4>' . __( 'My Coupons', 'couponxl' ) . '</h4>
    	<p><small>' . __( 'Check here coupons you have submitted or add new one', 'couponxl' ) . '</small></p>
    	</a>
    	</li>';
    endif;
    if( $theme_usage == 'all' || $theme_usage == 'deals' ):
    	$string .= '<li class="' . ( $subpage == 'my_deals' ? 'active' : '' ) . '">
    	<a href="' . esc_url( couponxl_append_query_string( $permalink, array( 'subpage' => 'my_deals' ), array( 'all' ) ) ) . '">
    	<h4>' . __( 'My Deals', 'couponxl' ) . '</h4>
    	<p><small>' . __( 'Check here deals you have submitted or add new one', 'couponxl' ) . '</small></p>
    	</a>
    	</li>';
    endif;
    $string .= '[/private]';
    echo do_shortcode( $string );
    ?>
    Thread Starter byjuststar

    (@byjuststar)

    Thank you very much alchymyth. best regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘php echo inside echo shortcode. php code role management’ is closed to new replies.