Execute php code in shortcode content in my theme template
-
First of all thank you very much for this great plugin.
I’m trying to use the shortcode directly in theme template. It works to a certain point where I tried to put some php code in the content. Below an example :
<?php $phpcode1 = echo esc_attr($EM_Event->event_name,ENT_QUOTES); $my_tabs = ' [su_tabs vertical="yes"] [su_tab title="Event Name"] <h3 class="event-form-name"></h3> <div class="inside event-form-name"> <input type="text" name="event_name" id="event-name" value="' .$phpcode1. '" /> <br /> </div> [/su_tab] [su_tab title="Title 2"]Content 2[/su_tab] [su_tab title="Title 3"]Content 3[/su_tab] [/su_tabs] '; echo do_shortcode( $my_tabs ); ?>I’ve tried this as well
<?php $my_tabs = ' [su_tabs vertical="yes"] [su_tab title="Event Name"] <h3 class="event-form-name"></h3> <div class="inside event-form-name"> <input type="text" name="event_name" id="event-name" value="<?php echo esc_attr($EM_Event->event_name,ENT_QUOTES); ?>" /> <br /> </div> [/su_tab] [su_tab title="Title 2"]Content 2[/su_tab] [su_tab title="Title 3"]Content 3[/su_tab] [/su_tabs] '; echo do_shortcode( $my_tabs ); ?>None of these work. I’m not developer, so I’m struggling a bit here. And I could find any similar topic. Any help will be appreciated.
Thanks.
The topic ‘Execute php code in shortcode content in my theme template’ is closed to new replies.