{"id":941040,"date":"2015-02-09T11:02:48","date_gmt":"2015-02-09T19:02:48","guid":{"rendered":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/acf-relationship-problem\/"},"modified":"2015-07-07T06:31:22","modified_gmt":"2015-07-07T13:31:22","slug":"acf-relationship-problem","status":"closed","type":"topic","link":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/acf-relationship-problem\/","title":{"rendered":"Acf relationship problem"},"content":{"rendered":"<p>I use the plugin ACF and relationship field for events and posts.<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"jZ819aYYje\"><p><a href=\"https:\/\/www.advancedcustomfields.com\/resources\/querying-relationship-fields\/\">Querying relationship fields<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"&#8220;Querying relationship fields&#8221; &#8212; ACF\" src=\"https:\/\/www.advancedcustomfields.com\/resources\/querying-relationship-fields\/embed\/#?secret=zn75D8dMD1#?secret=jZ819aYYje\" data-secret=\"jZ819aYYje\" width=\"580\" height=\"327\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<p>To display the current events in the post, I use the, for example, following code:<\/p>\n<pre><code>\t\n&lt;?php\n\t\t\t\t\t\t\/*\n\t\t\t\t\t\t*  Query posts for a relationship value.\n\t\t\t\t\t\t*  This method uses the meta_query LIKE to match the string &quot;123&quot; to the database value a:1:{i:0;s:3:&quot;123&quot;;} (serialized array)\n\t\t\t\t\t\t*\/\n\n\t\t\t\t$events = tribe_get_events(array(\n\t\t\t\t\t  &#039;post_type&#039;=&gt;array(TribeEvents::POSTTYPE),\n\t\t\t\t          &#039;posts_per_page&#039; =&gt; 12, \n\t\t\t\t          &#039;eventDisplay&#039;=&gt;&#039;upcoming&#039;,\n\t\t\t\t\t\t\t&#039;meta_query&#039; =&gt; array(\n\t\t\t\t\t\t\t\tarray(\n\t\t\t\t\t\t\t\t\t&#039;key&#039; =&gt; &#039;main-events&#039;, \/\/ name of custom field\n\t\t\t\t\t\t\t\t\t&#039;value&#039; =&gt; &#039;&quot;&#039; . get_the_ID() . &#039;&quot;&#039;, \/\/ matches exaclty &quot;123&quot;, not just 123. This prevents a match for &quot;1234&quot;\n\t\t\t\t\t\t\t\t\t&#039;compare&#039; =&gt; &#039;LIKE&#039;\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t));\n\n\t\t\t\t\t\t?&gt;\n\n\t\t\t\t\t\t&lt;?php if( $events ): ?&gt;\n\n\t\t\t\t\t\t\t&lt;div&gt;\n\n\t\t\t\t\t\t\t&lt;?php foreach( $events as $event ): ?&gt;\n\t\t\t\t\t\t\t&lt;div&gt;\t\t&lt;?php \n\t                                         \/*\n\t\t\t\t\t\t* for image\n\t\t\t\t\t\t*\/\n\t\t\t\t\t\techo tribe_event_featured_image( $event-&gt;ID, &#039;cspacing-marker-thumbnail&#039;, false );\n\t\t\t\t\t\t\t\t?&gt;\n                                                        &lt;\/div&gt;\n\n\t\t\t\t\t\t\t\t&lt;div&gt;\n\n\t\t\t\t\t\t\t&lt;a href=&quot;&lt;?php echo get_permalink( $event-&gt;ID ); ?&gt;&quot;&gt;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t&lt;?php echo get_the_title( $event-&gt;ID ); ?&gt;\n\t\t\t\t\t\t\t\t\t\t\t&lt;\/a&gt;\n\n\t\t\t\t\t\t\t\t&lt;\/div&gt;\n\t\t\t\t\t\t\t&lt;?php endforeach; ?&gt;\n\t\t\t\t\t\t\t&lt;\/div&gt;\n\t\t\t\t\t\t&lt;?php endif; ?&gt;\n<\/code><\/pre>\n<p>I want to add in the code above, the output of the date in this format:<\/p>\n<pre><code>\n\t&lt;div class=&quot;list-date&quot;&gt;\n\t\t&lt;span\n\t\t\tclass=&quot;list-dayname&quot;&gt;&lt;?php echo apply_filters( &#039;tribe-mini_helper_tribe_events_ajax_list_dayname&#039;, date_i18n( &#039;D&#039;, $postDate ), $postDate, $class ); ?&gt;&lt;\/span&gt;\n\t\t&lt;span\n\t\t\tclass=&quot;list-daynumber&quot;&gt;&lt;?php echo apply_filters( &#039;tribe-mini_helper_tribe_events_ajax_list_daynumber&#039;, date_i18n( &#039;d&#039;, $postDate ), $postDate, $class ); ?&gt;&lt;\/span&gt;\n\t&lt;\/div&gt;\n<\/code><\/pre>\n<p>Please help me how can I use this function in ACF and relationship field:<\/p>\n<pre><code>\n&lt;?php echo apply_filters( &#039;tribe-mini_helper_tribe_events_ajax_list_dayname&#039;, date_i18n( &#039;D&#039;, $postDate ), $postDate, $class ); ?&gt;\n<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-941040","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>Acf relationship problem -<\/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\/acf-relationship-problem\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Acf relationship problem -\" \/>\n<meta property=\"og:description\" content=\"I use the plugin ACF and relationship field for events and posts. Querying relationship fields To display the current events in the post, I use the, for example, following code: &lt;?php \/* * Query posts for a relationship value. * This method uses the meta_query LIKE to match the string &quot;123&quot; to the database value [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/acf-relationship-problem\/\" \/>\n<meta property=\"article:modified_time\" content=\"2015-07-07T13:31:22+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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/acf-relationship-problem\/\",\"url\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/acf-relationship-problem\/\",\"name\":\"Acf relationship problem -\",\"isPartOf\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/#website\"},\"datePublished\":\"2015-02-09T19:02:48+00:00\",\"dateModified\":\"2015-07-07T13:31:22+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/acf-relationship-problem\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/acf-relationship-problem\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/theeventscalendar.com\/support\/forums\/topic\/acf-relationship-problem\/#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\":\"Acf relationship problem\"}]},{\"@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":"Acf relationship problem -","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\/acf-relationship-problem\/","og_locale":"en_US","og_type":"article","og_title":"Acf relationship problem -","og_description":"I use the plugin ACF and relationship field for events and posts. Querying relationship fields To display the current events in the post, I use the, for example, following code: &lt;?php \/* * Query posts for a relationship value. * This method uses the meta_query LIKE to match the string &quot;123&quot; to the database value [&hellip;]","og_url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/acf-relationship-problem\/","article_modified_time":"2015-07-07T13:31:22+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/acf-relationship-problem\/","url":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/acf-relationship-problem\/","name":"Acf relationship problem -","isPartOf":{"@id":"https:\/\/theeventscalendar.com\/support\/#website"},"datePublished":"2015-02-09T19:02:48+00:00","dateModified":"2015-07-07T13:31:22+00:00","breadcrumb":{"@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/acf-relationship-problem\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/theeventscalendar.com\/support\/forums\/topic\/acf-relationship-problem\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/theeventscalendar.com\/support\/forums\/topic\/acf-relationship-problem\/#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":"Acf relationship problem"}]},{"@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\/941040","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\/941040\/revisions"}],"predecessor-version":[{"id":941203,"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/topic\/941040\/revisions\/941203"}],"wp:attachment":[{"href":"https:\/\/theeventscalendar.com\/support\/wp-json\/wp\/v2\/media?parent=941040"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}