block-portfolio-item.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. $logo = get_field('logo');
  3. $title = get_field('title');
  4. $description = get_field('description');
  5. $url = 'http://103.109.52.3/webapi/api/EmployeeInfo';
  6. $response = wp_remote_post(
  7. $url,
  8. array(
  9. // 'timeout' => 120,
  10. // 'httpversion' => '1.1',
  11. 'body' => array(
  12. 'user_login_id' => 'api_user',
  13. 'login_id' => 'SS',
  14. 'auth_token' => 'api_user20230419045143'
  15. )
  16. )
  17. );
  18. // $url = 'https://www.flickr.com/services/rest/';
  19. // $arguments = array(
  20. // 'api_key' => 'f49df4a290d8f224ecd56536af51FF77',
  21. // 'method' => 'flickr.people.getPublicPhotos',
  22. // 'format' => 'json',
  23. // 'user_id' => $user_id,
  24. // 'per_page'=> $photos_number,
  25. // );
  26. // $url_parameters = array();
  27. // foreach ($arguments as $key => $value){
  28. // $url_parameters[] = $key.'='.$value;
  29. // }
  30. // $url = $url.implode('&', $url_parameters);
  31. // $request = wp_remote_get($url, $options);
  32. // return load_request($request);
  33. // function load_request($response)
  34. // {
  35. // try {
  36. // $json = json_decode($response['body']);
  37. // } catch (Exception $ex) {
  38. // $json = null;
  39. // }
  40. // return $json;
  41. // }
  42. echo '<div class="portfolio-item">';
  43. if (!empty($logo))
  44. echo wp_get_attachment_image($logo['ID'], 'thumbnail', null, array('class' => 'portfolio-logo alignleft'));
  45. if (!empty($title))
  46. echo '<h3 class="portfolio-title">' . $title . '</h3>';
  47. if (!empty($description))
  48. echo '<div class="portfolio-description">' . $description . '</div>';
  49. var_dump($response);
  50. // echo '<div class="test">' . $request . '</div>';
  51. echo '</div>';