Conditional Shortcode problem
-
hey guys.. i am creating a shortcode that should return a specific image among other stuff depending on the user entered value
here it is:
function postInfoBoxSc( $atts ) { extract( shortcode_atts( array( 'subject' => 'Category type', 'difficulty' => 'User Types', 'completiontime' => 'completion Time' ), $atts ) ); // Set image acorring to guide type if ($subject == 'wordpress') { $subjectImg = '<img src="'.get_bloginfo('template_url').'/img/postInfoBox/wordpress.png" alt="מדריך וורדפרס" />'; } elseif ($subject == 'web design') { $subjectImg = '<img src="'.get_bloginfo('template_url').'/img/postInfoBox/webDesign.png" alt="מדריך בניית אתרים" />'; } elseif ($subject == 'facebook') { $subjectImg = '<img src="'.get_bloginfo('template_url').'/img/postInfoBox/facebook.png" alt="מדריך פייסבוק" />'; } elseif ($subject == 'RSS') { $subjectImg = '<img src="'.get_bloginfo('template_url').'/img/postInfoBox/rss.png" alt="מדריך RSS" />'; } return ' <br class="clear" /> <div class="postInfoBox"> '. $subjectImg .' <h5>Guide information:</h5> <ul> <li><strong>Category:</strong> '. $subject .'</li> <li><strong>User Lever:</strong> '. $difficulty .'</li> <li><strong>completion Time:</strong> '. $completiontime .'</li> </ul> </div> '; } add_shortcode( 'postInfoBox', 'postInfoBoxSc' );
No matter what i do the value for subject isnt being checkd..
What am i doing wrong?
- The topic ‘Conditional Shortcode problem’ is closed to new replies.