Conditional Statements
-
Hi,
Again, great plugin and I’m loving the custom shortcodes creator. I need some help with my echo php…
I’m a novice in php so please be patient – I can figure it out with some input.
Ok, I have a custom shortcode that inputs your tabs shortcode and it works perfectly. I have all the attributes set and it works, but I noticed it doesn’t follow the logic of what the shortcode is desired to do.
I had assumed when a switch is off the attribute would not be included but I believe my php is the culprit because it’s not following the logic intended.
In my php I need conditions set so if a switch is off that attribute is not included in the output.
For example, I have tabs that include 5 switches. If any given switch is off I need it excluded. At this time it is included no matter what. Maybe I’m using the custom shortcode creator wrong too.
Any insight is greatly appreciated.
Forgive my errors in php, I’ve tried several variations and here’s what I have.
$tabs_open = '[su_tabs vertical="yes"]'; $tabs_close = '[/su_tabs]'; $available_work = '[su_tab title="AVAILABLE WORK"]<h4>AVAILABLE WORK</h4>[portfolio_grid column="2" showposts="40" cat="available-work-'.$artist_slug.'" disable="excerpt,date,more,visit"][/su_tab]'; $exhibitions = '[su_tab title="EXHIBITIONS"] <h4>EXHIBITIONS</h4>[portfolio_grid column="2" showposts="40" cat="exhibits-mary-newton" disable="excerpt,date,more,visit,pagination"][/su_tab]'; $artist_statement = '[su_tab title="ARTIST STATEMENT"]<h4>ARTIST STATEMENT</h4>'.$artist_statement_text.'[/su_tab]'; $biography = '[su_tab title="BIOGRAPHY"]<h4>BIOGRAPHY</h4>'.$biography_text.'[/su_tab]'; $press = '[su_tab title="PRESS"]<h4>PRESS</h4>[portfolio_grid column="2" showposts="40" cat="press-mary-newton" disable="excerpt,date,more,visit,pagination"][/su_tab]'; echo do_shortcode($tabs_open.$available_work.$exhibitions.$artist_statement.$biography.$press.$tabs_close);
This outputs all tabs, switched or not.
- The topic ‘Conditional Statements’ is closed to new replies.