{"id":1475482,"date":"2018-03-10T08:21:52","date_gmt":"2018-03-10T16:21:52","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-fields-and-series-data-for-list\/"},"modified":"2018-03-12T12:48:39","modified_gmt":"2018-03-12T19:48:39","slug":"custom-fields-and-series-data-for-list","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-fields-and-series-data-for-list\/","title":{"rendered":"custom fields and series data for list"},"content":{"rendered":"<p>I was able to follow the documentation below (Introduction to The Events Calendar REST API) to output additional custom fields with following code:<\/p>\n<p>`\/\/ this filter adds the custom field values to the json output<br \/>\nadd_filter( &#8216;tribe_rest_single_event_data&#8217;, &#8216;elternbildung_additional_data&#8217; );<\/p>\n<p>function elternbildung_additional_data( array $event_data ) {<br \/>\n$event_id = $event_data[&#8216;id&#8217;];<\/p>\n<p>$Referent = get_post_meta( $event_id, &#8216;_ecp_custom_3&#8217;, true );<br \/>\n$Details_Anmeldung = get_post_meta( $event_id, &#8216;_ecp_custom_4&#8217;, true );<br \/>\n$Fotorechte = get_post_meta( $event_id, &#8216;_ecp_custom_7&#8217;, true );<br \/>\n$Preis = get_post_meta( $event_id, &#8216;_ecp_custom_16&#8217;, true );<\/p>\n<p>$event_data[&#8216;Referent&#8217;] = $Referent;<br \/>\n$event_data[&#8216;Details_Anmeldung&#8217;] = $Details_Anmeldung;<br \/>\n$event_data[&#8216;Fotorechte&#8217;] = $Fotorechte;<br \/>\n$event_data[&#8216;Preis&#8217;] = $Preis;<\/p>\n<p>return $event_data;<br \/>\n}`<\/p>\n<p>This works ok but actually I need the information on the list (meaning here: http:\/\/elternbildung-aargau.ch\/wp-json\/tribe\/events\/v1\/events not only here: http:\/\/elternbildung-aargau.ch\/wp-json\/tribe\/events\/v1\/events\/2248 (example)<\/p>\n<p>Any hints how I could accomplish this?<\/p>\n<p>The filter &#8220;tribe_rest_events_archive_data&#8221; seems to work somewhat but adds the a single event custom fields to the end instead of looping. Propably I just do it wrong, but need some help here.<\/p>\n<p>Also I&#8217;d need to have the dates (and URL&#8217;s) of all single events within a series, but I can&#8217;t figure out how to get this.<\/p>\n<p>E. g. http:\/\/elternbildung-aargau.ch\/wp-json\/tribe\/events\/v1\/events\/2248 is a series.<\/p>\n<p>But how can I get the dates and urls of the single events listed?<\/p>\n<p>Thanks for hints.<\/p>\n<p>https:\/\/theeventscalendar.com\/knowledgebase\/introduction-events-calendar-rest-api\/<\/p>\n","protected":false},"template":"","class_list":["post-1475482","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>custom fields and series data for list -<\/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\/custom-fields-and-series-data-for-list\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"custom fields and series data for list -\" \/>\n<meta property=\"og:description\" content=\"I was able to follow the documentation below (Introduction to The Events Calendar REST API) to output additional custom fields with following code: `\/\/ this filter adds the custom field values to the json output add_filter( &#8216;tribe_rest_single_event_data&#8217;, &#8216;elternbildung_additional_data&#8217; ); function elternbildung_additional_data( array $event_data ) { $event_id = $event_data[&#8216;id&#8217;]; $Referent = get_post_meta( $event_id, &#8216;_ecp_custom_3&#8217;, true ); [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-fields-and-series-data-for-list\/\" \/>\n<meta property=\"article:modified_time\" content=\"2018-03-12T19:48:39+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\/custom-fields-and-series-data-for-list\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-fields-and-series-data-for-list\/\",\"name\":\"custom fields and series data for list -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2018-03-10T16:21:52+00:00\",\"dateModified\":\"2018-03-12T19:48:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-fields-and-series-data-for-list\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-fields-and-series-data-for-list\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-fields-and-series-data-for-list\/#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\":\"Events Calendar PRO\",\"item\":\"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"custom fields and series data for list\"}]},{\"@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":"custom fields and series data for list -","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\/custom-fields-and-series-data-for-list\/","og_locale":"en_US","og_type":"article","og_title":"custom fields and series data for list -","og_description":"I was able to follow the documentation below (Introduction to The Events Calendar REST API) to output additional custom fields with following code: `\/\/ this filter adds the custom field values to the json output add_filter( &#8216;tribe_rest_single_event_data&#8217;, &#8216;elternbildung_additional_data&#8217; ); function elternbildung_additional_data( array $event_data ) { $event_id = $event_data[&#8216;id&#8217;]; $Referent = get_post_meta( $event_id, &#8216;_ecp_custom_3&#8217;, true ); [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-fields-and-series-data-for-list\/","article_modified_time":"2018-03-12T19:48:39+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\/custom-fields-and-series-data-for-list\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-fields-and-series-data-for-list\/","name":"custom fields and series data for list -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2018-03-10T16:21:52+00:00","dateModified":"2018-03-12T19:48:39+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-fields-and-series-data-for-list\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-fields-and-series-data-for-list\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/custom-fields-and-series-data-for-list\/#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":"Events Calendar PRO","item":"https:\/\/theeventscalendar.com\/support\/forums\/forum\/events\/events-calendar-pro\/"},{"@type":"ListItem","position":5,"name":"custom fields and series data for list"}]},{"@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\/1475482","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":1,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1475482\/revisions"}],"predecessor-version":[{"id":1476812,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/1475482\/revisions\/1476812"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=1475482"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}