php function not working because of missing return or echo
-
Putting the form directly into the template with php code <?php elp_subbox(“NO”, “desc”); ?> is currently not working, because you missed to output something from elp_subbox in classes/loadwidget.php on line 228.
You need to echo or return elp_cls_shortcode::elp_shortcode_prepare($atts);
I suggest to use return and leave the echo to the template developer like this:
function elp_subbox( $elp_name = "YES", $elp_desc = "" ) { $atts = array(); $atts["namefield"] = $elp_name; $atts["desc"] = $elp_desc; $atts["group"] = "Public"; //$atts["type"] = "subbox"; //echo elp_shortcode( $atts ); return elp_cls_shortcode::elp_shortcode_prepare($atts); }Now the php function needs to be called with echo:
<?php echo elp_subbox("YES", "description"); ?>
The topic ‘php function not working because of missing return or echo’ is closed to new replies.