not really known
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. // ini_set( 'display_errors', 1 );
  3. // error_reporting( E_ALL ^ E_NOTICE );
  4. define( 'WP_USE_THEMES', false );
  5. require_once( '../../../../wp-load.php' );
  6. $options = array(
  7. 'post_type' => 'site',
  8. 'posts_per_page' => -1, // -1 for all posts
  9. 'post_status' => 'publish',
  10. 'orderby' => 'title',
  11. 'order' => 'ASC'
  12. );
  13. $query = new WP_Query( $options ) or die("WP Query failed");
  14. $sites = array();
  15. if ( $query->have_posts() ) :
  16. while ( $query->have_posts() ) : $query->the_post() ;
  17. $meta = get_post_meta( get_the_ID() );
  18. // party_affiliation
  19. // hyperlocal_group_id
  20. $row = array(
  21. 'title' => get_the_title(),
  22. 'url' => get_permalink(),
  23. 'feed_url' => $meta['feed_url'][0],
  24. 'date_created' => get_the_date("c"),
  25. 'date_modified' => get_the_modified_date("c"),
  26. 'lat' => (float)$meta['geo_latitude'][0],
  27. 'lon' => (float)$meta['geo_longitude'][0],
  28. 'radius_miles' => (float)$meta['distance_covered_miles'][0],
  29. 'area_covered' => $meta['area_covered'][0],
  30. 'body' => get_the_content(),
  31. 'area_covered' => $meta['area_covered'][0],
  32. 'country' => get_the_terms( get_the_ID(), 'countries' ),
  33. 'council' => get_the_terms( get_the_ID(), 'councils' ),
  34. 'platform' => get_the_terms( get_the_ID(), 'platforms' ),
  35. );
  36. $sites[]= $row;
  37. endwhile;
  38. else :
  39. echo "No posts matched the query";
  40. endif;
  41. header( "Content-Type: application/json" );
  42. echo json_encode( $sites );