how to run function
-
i have a code and i am using bootstrap modal need to send data through with my define function.but i cant solve my problem please solve it. when user click my button function execute and display the correct answer i am not a expert so please help thank you ?? this is my function.php file data. i know problem in this line array(‘post_title’ => $post->post_title, ‘person_name’ => function_exists( ‘user_address’ ) because of function call please provide a correct way to call function
if( !function_exists( 'user_address' ) ){ function user_address(){ $person_name= get_field('address_url'); $rebeka = 'Rebeka'; $jhon = 'Jhon'; $rita = 'Rita'; if ($person_name==$rebeka) { echo ($person_name),('nice girl'); } else if ($person_name==$jhon) { echo ($person_name),('good name'); }else if ($person_name==$rita) { echo ($person_name),('hot'); }else{ echo ('how are you'),($person_name); } } add_action( 'address_url', 'user_address', 0 ); } add_action('wp_ajax_nopriv_show_post', 'show_post'); function show_post(){ $id = $_GET['id']; $post = get_post($id); if($post){ wp_send_json( array('post_title' => $post->post_title, 'person_name' => function_exists( 'user_address' ) )); } else { wp_send_json(array('error' => '1')); } wp_die(); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘how to run function’ is closed to new replies.