block-faculty-member.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. $id = 'testimonial-' . $block['id'];
  3. $login_id = get_field('login_id');
  4. $url = 'http://103.109.52.3/webapi/api/EmployeeInfo';
  5. $response = wp_remote_post(
  6. $url,
  7. array(
  8. 'body' => array(
  9. 'user_login_id' => 'api_user',
  10. 'login_id' => $login_id,
  11. 'auth_token' => 'api_user20230419045143'
  12. )
  13. )
  14. );
  15. $data = json_decode(wp_remote_retrieve_body($response), true);
  16. // foreach ($data as $query) {
  17. // $EmployeeID = $query['EmployeeID'];
  18. // }
  19. echo '<div class="portfolio-item">';
  20. // if (!empty($logo)) {
  21. // echo wp_get_attachment_image($logo['ID'], 'thumbnail', null, array('class' => 'portfolio-logo alignleft'));
  22. // }
  23. if (!empty($login_id)) {
  24. echo '<h3 class="portfolio-title">Faculty Member Information (Read only)</h3>';
  25. echo '<div class="portfolio-description"> <ul>';
  26. foreach ($data[0] as $key => $value) {
  27. echo "<li> <strong>" . $key . " </strong>: " . $value . "</li>\n";
  28. }
  29. } else {
  30. echo 'Please insert Login ID of the faculty member</ul></div>';
  31. }
  32. // var_dump($data[0]);
  33. // print_r($data);
  34. echo '</div>';