{"id":1074629,"date":"2016-02-17T12:31:55","date_gmt":"2016-02-17T20:31:55","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/"},"modified":"2016-03-03T08:35:04","modified_gmt":"2016-03-03T16:35:04","slug":"any-wp-api-customization-to-get-day-events","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/","title":{"rendered":"Any wp-api customization to get day events??"},"content":{"rendered":"<p>I\u00b4m trying to customize the query to get all day events for my ionic-mobile-app using wp-api, but i only can get incoming events.<\/p>\n<p>My code is something like this:<\/p>\n<pre><code>add_action( &#039;init&#039;, &#039;tribe_events_post_type_rest_support&#039;, 25 );\n  function tribe_events_post_type_rest_support() {\n    global $wp_post_types;\n\n    \/\/be sure to set this to the name of your post type!\n    $post_type_name = &#039;tribe_events&#039;;\n    if( isset( $wp_post_types[ $post_type_name ] ) ) {\n        $wp_post_types[$post_type_name]-&gt;show_in_rest = true;\n        $wp_post_types[$post_type_name]-&gt;rest_base = $post_type_name;\n        $wp_post_types[$post_type_name]-&gt;rest_controller_class = &#039;WP_REST_Posts_Controller&#039;;\n    }\n  }\n\nfunction add_meta_to_json($data, $post, $request) {\n    $response_data = $data-&gt;get_data();\n    if ( $request[&#039;context&#039;] !== &#039;view&#039; || is_wp_error( $data ) ) {\n        return $data;\n    }\n\n    if ($response_data[&#039;type&#039;] == &#039;tribe_events&#039;) {\n        $response_data[&#039;event_meta&#039;] = get_post_meta($response_data[&#039;id&#039;]);\n    }\n\n    $thumbnail_id = get_post_thumbnail_id( $post-&gt;ID );\n    $thumbnail = wp_get_attachment_image_src( $thumbnail_id );\n    $response_data[&#039;featured_image_thumbnail_url&#039;] = $thumbnail[0];\n    $data-&gt;data = $response_data;\n\n    return $data;\n}\nadd_filter(&#039;rest_prepare_tribe_events&#039;, &#039;add_meta_to_json&#039;, 10, 3);\n<\/code><\/pre>\n<p>As you can see i\u00b4m using custom-post-type and getting all the meta info, but i don\u00b4t know how to customize the query to get something like this:<\/p>\n<pre><code>$events = tribe_get_events( array(\n    &#039;eventDisplay&#039; =&gt; &#039;custom&#039;,\n    &#039;start_date&#039;   =&gt; &#039;2014-10-01 00:01&#039;,\n    &#039;end_date&#039;     =&gt; &#039;2014-10-31 23:59&#039;\n) );<\/code><\/pre>\n<p>Can anyone help me o give me some advice to get via wp-api all day events (past or incoming) with all the meta-data??<\/p>\n<p>Thx!<\/p>\n","protected":false},"template":"","class_list":["post-1074629","topic","type-topic","status-closed","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Any wp-api customization to get day events?? -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Any wp-api customization to get day events?? -\" \/>\n<meta property=\"og:description\" content=\"I\u00b4m trying to customize the query to get all day events for my ionic-mobile-app using wp-api, but i only can get incoming events. My code is something like this: add_action( &#039;init&#039;, &#039;tribe_events_post_type_rest_support&#039;, 25 ); function tribe_events_post_type_rest_support() { global $wp_post_types; \/\/be sure to set this to the name of your post type! $post_type_name = &#039;tribe_events&#039;; if( [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/\" \/>\n<meta property=\"article:modified_time\" content=\"2016-03-03T16:35:04+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/\",\"name\":\"Any wp-api customization to get day events?? -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2016-02-17T20:31:55+00:00\",\"dateModified\":\"2016-03-03T16:35:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/theeventscalendar.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Topics\",\"item\":\"https:\/\/theeventscalendar.com\/support\/topics\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Calendar Products\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Community Events\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/community-events\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"Any wp-api customization to get day events??\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\",\"url\":\"https:\/\/theeventscalendar.com\/support\/\",\"name\":\"\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Any wp-api customization to get day events?? -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/","og_locale":"en_US","og_type":"article","og_title":"Any wp-api customization to get day events?? -","og_description":"I\u00b4m trying to customize the query to get all day events for my ionic-mobile-app using wp-api, but i only can get incoming events. My code is something like this: add_action( &#039;init&#039;, &#039;tribe_events_post_type_rest_support&#039;, 25 ); function tribe_events_post_type_rest_support() { global $wp_post_types; \/\/be sure to set this to the name of your post type! $post_type_name = &#039;tribe_events&#039;; if( [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/","article_modified_time":"2016-03-03T16:35:04+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/","name":"Any wp-api customization to get day events?? -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2016-02-17T20:31:55+00:00","dateModified":"2016-03-03T16:35:04+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/any-wp-api-customization-to-get-day-events\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/theeventscalendar.com\/support\/"},{"@type":"ListItem","position":2,"name":"Topics","item":"https:\/\/theeventscalendar.com\/support\/topics\/"},{"@type":"ListItem","position":3,"name":"Calendar Products","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/"},{"@type":"ListItem","position":4,"name":"Community Events","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/community-events\/"},{"@type":"ListItem","position":5,"name":"Any wp-api customization to get day events??"}]},{"@type":"WebSite","@id":"https:\/\/theeventscalendar.com\/support\/#website","url":"https:\/\/theeventscalendar.com\/support\/","name":"","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/theeventscalendar.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1074629","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":2,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1074629\/revisions"}],"predecessor-version":[{"id":1074636,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1074629\/revisions\/1074636"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1074629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}