PHP Echo inside Wordpress Shortcode PHP Echo inside Wordpress Shortcode wordpress wordpress

PHP Echo inside Wordpress Shortcode


In the my_contact_form_generate_response function, you can do return $response; at the very bottom before the closing } for the function.

Then, you can do echo my_contact_form_generate_response($type, $message); and it will echo the return value, which will be $response in this case.


Try to change

else if ($_POST['submitted']) my_contact_form_generate_response("error", $missing_content);

To

else if ($_POST['submitted']){    $response = 'Some things';    $response .= my_contact_form_generate_response("error", $missing_content);    return $response;}


I had to call $response from global

function form_response(){    echo $GLOBALS["response"];}