diff --git a/wp-content/plugins/embl-taxonomy/includes/register.php b/wp-content/plugins/embl-taxonomy/includes/register.php index fbbbf0b5c..ee1e83e8e 100644 --- a/wp-content/plugins/embl-taxonomy/includes/register.php +++ b/wp-content/plugins/embl-taxonomy/includes/register.php @@ -768,21 +768,21 @@ public function action_admin_notices() { $notice = false; // Sync required (all pages) - if (($now - $modified) >= EMBL_Taxonomy::MAX_AGE) { - printf('

%2$s %3$s

', - esc_attr('notice notice-warning'), - esc_html(sprintf( - __('The %1$s may be outdated and should be synced', 'embl'), - $this->labels['name'] - )), - sprintf( - '', - esc_attr('edit-tags.php?taxonomy=' . EMBL_Taxonomy::TAXONOMY_NAME . '&sync=true'), - esc_html(__('Sync now', 'embl')) - ) - ); - $notice = true; - } + // if (($now - $modified) >= EMBL_Taxonomy::MAX_AGE) { + // printf('

%2$s %3$s

', + // esc_attr('notice notice-warning'), + // esc_html(sprintf( + // __('The %1$s may be outdated and should be synced', 'embl'), + // $this->labels['name'] + // )), + // sprintf( + // '', + // esc_attr('edit-tags.php?taxonomy=' . EMBL_Taxonomy::TAXONOMY_NAME . '&sync=true'), + // esc_html(__('Sync now', 'embl')) + // ) + // ); + // $notice = true; + // } // Sync happened (all pages) // if (($now - $modified) <= 10) { diff --git a/wp-content/plugins/vf-embl-news-block/acf.json b/wp-content/plugins/vf-embl-news-block/acf.json index 11b53772d..95acc57e2 100644 --- a/wp-content/plugins/vf-embl-news-block/acf.json +++ b/wp-content/plugins/vf-embl-news-block/acf.json @@ -3,11 +3,12 @@ "title": "VF EMBL News", "fields": [ { - "key": "field_60bf5b1d10f6d", - "label": "Display publications", - "name": "display_publication", + "key": "field_679e43a8ff272", + "label": "Data pull method", + "name": "news_fetch", + "aria-label": "", "type": "select", - "instructions": "", + "instructions": "For Admin only", "required": 0, "conditional_logic": 0, "wrapper": { @@ -16,25 +17,88 @@ "id": "" }, "choices": { - "embl": "EMBL News", - "embl-ebi": "EMBL-EBI News" + "default": "Default", + "custom": "Custom endpoints", + "contenthub": "contentHub HTML" }, - "default_value": "embl", - "allow_null": 0, + "default_value": "default", + "return_format": "value", "multiple": 0, + "allow_null": 0, + "allow_in_bindings": 1, "ui": 0, - "return_format": "value", "ajax": 0, "placeholder": "" }, + { + "key": "field_679e2ac32681b", + "label": "WP REST API 1", + "name": "wprest_api_1", + "aria-label": "", + "type": "url", + "instructions": "Example:\r\nhttps:\/\/www.embl.org\/news\/wp-json\/custom\/v1\/posts?taxonomy_slug=alumni-relations", + "required": 0, + "conditional_logic": [ + [ + { + "field": "field_679e43a8ff272", + "operator": "==", + "value": "custom" + } + ] + ], + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "default_value": "", + "allow_in_bindings": 0, + "placeholder": "" + }, + { + "key": "field_679e2b3b2681c", + "label": "WP REST API 2", + "name": "wprest_api_2", + "aria-label": "", + "type": "url", + "instructions": "Example:\r\nhttps:\/\/www.embl.org\/news\/wp-json\/custom\/v1\/awards?award_site=grenoble&award_unit=molecular%20systems%20biology", + "required": 0, + "conditional_logic": [ + [ + { + "field": "field_679e43a8ff272", + "operator": "==", + "value": "custom" + } + ] + ], + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "default_value": "", + "allow_in_bindings": 0, + "placeholder": "" + }, { "key": "field_5eb014ed283d9", "label": "Limit", "name": "limit", + "aria-label": "", "type": "range", "instructions": "Maximum number of articles to display.", "required": 0, - "conditional_logic": 0, + "conditional_logic": [ + [ + { + "field": "field_679e43a8ff272", + "operator": "==", + "value": "default" + } + ] + ], "wrapper": { "width": "", "class": "", @@ -43,18 +107,63 @@ "default_value": 3, "min": 1, "max": 20, + "allow_in_bindings": 1, "step": "", "prepend": "", "append": "" }, + { + "key": "field_60bf5b1d10f6d", + "label": "Display publications", + "name": "display_publication", + "aria-label": "", + "type": "select", + "instructions": "", + "required": 0, + "conditional_logic": [ + [ + { + "field": "field_679e43a8ff272", + "operator": "==", + "value": "default" + } + ] + ], + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "choices": { + "embl": "EMBL News", + "embl-ebi": "EMBL-EBI News" + }, + "default_value": "embl", + "return_format": "value", + "multiple": 0, + "allow_null": 0, + "allow_in_bindings": 1, + "ui": 0, + "ajax": 0, + "placeholder": "" + }, { "key": "field_61b88fe5f7a3f", "label": "Variant", "name": "variant", + "aria-label": "", "type": "radio", "instructions": "", "required": 0, - "conditional_logic": 0, + "conditional_logic": [ + [ + { + "field": "field_679e43a8ff272", + "operator": "==", + "value": "default" + } + ] + ], "wrapper": { "width": "", "class": "", @@ -64,21 +173,31 @@ "vf-news-item-default": "Default", "vf-news-container-featured": "Container" }, + "default_value": "vf-news-item-default", + "return_format": "value", "allow_null": 0, "other_choice": 0, - "default_value": "vf-news-item-default", + "allow_in_bindings": 1, "layout": "horizontal", - "return_format": "value", "save_other_choice": 0 }, { "key": "field_5eb01560283da", "label": "Search by", "name": "type", + "aria-label": "", "type": "select", "instructions": "", "required": 0, - "conditional_logic": 0, + "conditional_logic": [ + [ + { + "field": "field_679e43a8ff272", + "operator": "==", + "value": "default" + } + ] + ], "wrapper": { "width": "", "class": "", @@ -92,10 +211,11 @@ "tags": "Free Tag(s)" }, "default_value": "latest", - "allow_null": 0, + "return_format": "value", "multiple": 0, + "allow_null": 0, + "allow_in_bindings": 1, "ui": 0, - "return_format": "value", "ajax": 0, "placeholder": "" }, @@ -103,6 +223,7 @@ "key": "field_5eb029fdc00fb", "label": "Latest", "name": "", + "aria-label": "", "type": "message", "instructions": "", "required": 0, @@ -112,12 +233,22 @@ "field": "field_5eb01560283da", "operator": "==", "value": "latest" + }, + { + "field": "field_679e43a8ff272", + "operator": "==", + "value": "default" } ], [ { "field": "field_5eb01560283da", "operator": "==empty" + }, + { + "field": "field_679e43a8ff272", + "operator": "==", + "value": "default" } ] ], @@ -134,6 +265,7 @@ "key": "field_5eb01627283db", "label": "EMBL Taxonomy", "name": "embl_terms", + "aria-label": "", "type": "taxonomy", "instructions": "Filter news by EMBL taxonomy term.", "required": 0, @@ -143,6 +275,11 @@ "field": "field_5eb01560283da", "operator": "==", "value": "taxonomy" + }, + { + "field": "field_679e43a8ff272", + "operator": "==", + "value": "default" } ] ], @@ -152,18 +289,22 @@ "id": "" }, "taxonomy": "embl_taxonomy", - "field_type": "select", - "allow_null": 1, "add_term": 0, "save_terms": 0, "load_terms": 0, "return_format": "id", - "multiple": 0 + "field_type": "select", + "allow_null": 1, + "allow_in_bindings": 1, + "bidirectional": 0, + "multiple": 0, + "bidirectional_target": [] }, { "key": "field_5eb01691283dc", "label": "Keyword", "name": "keyword", + "aria-label": "", "type": "text", "instructions": "Filter news by a keyword search.", "required": 0, @@ -173,6 +314,11 @@ "field": "field_5eb01560283da", "operator": "==", "value": "keyword" + }, + { + "field": "field_679e43a8ff272", + "operator": "==", + "value": "default" } ] ], @@ -182,15 +328,17 @@ "id": "" }, "default_value": "", + "maxlength": "", + "allow_in_bindings": 1, "placeholder": "", "prepend": "", - "append": "", - "maxlength": "" + "append": "" }, { "key": "field_5eb016ca283dd", "label": "Article ID(s)", "name": "ids", + "aria-label": "", "type": "text", "instructions": "Filter news by article IDs (comma separated, e.g. \"9996, 12060\").", "required": 0, @@ -200,6 +348,11 @@ "field": "field_5eb01560283da", "operator": "==", "value": "ids" + }, + { + "field": "field_679e43a8ff272", + "operator": "==", + "value": "default" } ] ], @@ -209,15 +362,17 @@ "id": "" }, "default_value": "", + "maxlength": "", + "allow_in_bindings": 1, "placeholder": "", "prepend": "", - "append": "", - "maxlength": "" + "append": "" }, { "key": "field_5eb01805283df", "label": "Free Tag(s)", "name": "tags", + "aria-label": "", "type": "text", "instructions": "Filter news by tags (comma separated, e.g. \"bioinformatics, chemistry\").", "required": 0, @@ -227,6 +382,11 @@ "field": "field_5eb01560283da", "operator": "==", "value": "tags" + }, + { + "field": "field_679e43a8ff272", + "operator": "==", + "value": "default" } ] ], @@ -236,10 +396,95 @@ "id": "" }, "default_value": "", + "maxlength": "", + "allow_in_bindings": 1, "placeholder": "", "prepend": "", - "append": "", - "maxlength": "" + "append": "" + }, + { + "key": "field_67a08be960436", + "label": "contentHub data fetch HTML", + "name": "contenthub_data_fetch", + "aria-label": "", + "type": "textarea", + "instructions": "", + "required": 0, + "conditional_logic": [ + [ + { + "field": "field_679e43a8ff272", + "operator": "==", + "value": "contenthub" + } + ] + ], + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "default_value": "", + "maxlength": "", + "allow_in_bindings": 0, + "rows": "", + "placeholder": "", + "new_lines": "" + }, + { + "key": "field_67a09b7de6cb9", + "label": "Section header", + "name": "section_header_text", + "aria-label": "", + "type": "text", + "instructions": "", + "required": 0, + "conditional_logic": [ + [ + { + "field": "field_679e43a8ff272", + "operator": "==", + "value": "custom" + } + ] + ], + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "default_value": "Latest news", + "maxlength": "", + "allow_in_bindings": 1, + "placeholder": "", + "prepend": "", + "append": "" + }, + { + "key": "field_67a1d5d158acc", + "label": "Section header URL", + "name": "section_header_url", + "aria-label": "", + "type": "url", + "instructions": "", + "required": 0, + "conditional_logic": [ + [ + { + "field": "field_679e43a8ff272", + "operator": "==", + "value": "custom" + } + ] + ], + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "default_value": "https:\/\/www.embl.org\/news\/", + "allow_in_bindings": 0, + "placeholder": "" } ], "location": [ @@ -259,5 +504,5 @@ "hide_on_screen": "", "active": true, "description": "VF EMBL News ACF Gutenberg block", - "modified": 1642671260 + "show_in_rest": 0 } \ No newline at end of file diff --git a/wp-content/plugins/vf-embl-news-block/index.php b/wp-content/plugins/vf-embl-news-block/index.php index 184385d10..0d8fd7cd0 100644 --- a/wp-content/plugins/vf-embl-news-block/index.php +++ b/wp-content/plugins/vf-embl-news-block/index.php @@ -32,6 +32,7 @@ public function __construct() { 'acf/settings/load_json', array($this, 'acf_settings_load_json') ); + } /** diff --git a/wp-content/plugins/vf-embl-news-block/template.php b/wp-content/plugins/vf-embl-news-block/template.php index 2599f9bac..eb9eac37d 100644 --- a/wp-content/plugins/vf-embl-news-block/template.php +++ b/wp-content/plugins/vf-embl-news-block/template.php @@ -1,19 +1,4 @@ 20 ? 3 : $limit; @@ -45,6 +30,9 @@ $tags = explode(',', $tags ?? ''); $tags = array_map('trim', $tags); + +if ($fetch == 'default' || empty($fetch)) { + if (is_int($embl_terms)) { $embl_terms = array($embl_terms); } @@ -139,5 +127,129 @@ ); echo $content; +} + +else if($fetch == 'custom') { +// Show default preview instruction +if (empty(get_field('wprest_api_1')) && empty(get_field('wprest_api_2'))) { + if ($is_preview) { ?> +
+
+

+ +

+
+
+ + +
+ +document.addEventListener("DOMContentLoaded", async function() { + async function fetchAndDisplayLatestProjects() { + const endpoint1 = "' . esc_js(get_field('wprest_api_1')) . '"; + const endpoint2 = "' . esc_js(get_field('wprest_api_2')) . '"; + const header = "' . esc_js(get_field('section_header_text')) . '"; + const headerURL = "' . esc_js(get_field('section_header_url')) . '"; + + console.log("Fetching from:", endpoint1, endpoint2); // Debugging + + const endpoints = [endpoint1, endpoint2].filter(Boolean); // Filter out empty endpoints + let mergedPosts = []; + + for (const endpoint of endpoints) { + try { + const response = await fetch(endpoint); + if (!response.ok) throw new Error("Network response was not ok: " + response.statusText); + const data = await response.json(); + console.log("Data from", endpoint, data); // Debugging + + if (Array.isArray(data)) { + mergedPosts = mergedPosts.concat(data); + } else if (Array.isArray(data.posts)) { + mergedPosts = mergedPosts.concat(data.posts); + } + } catch (error) { + console.error("Error fetching data from", endpoint, error); + } + } + + if (mergedPosts.length === 0) { + console.warn("No posts found."); + return; + } + + const normalizedPosts = mergedPosts.map(post => ({ + id: post.id, + title: post.title?.rendered || post.title || "No title", + date: post.date || new Date().toISOString(), + excerpt: post.excerpt?.rendered ? post.excerpt.rendered.replace(/<[^>]+>/g, "") : (post.excerpt || ""), + image: post.featured_image_src, + url: post.link || post.url || "#" + })); + + normalizedPosts.sort((a, b) => new Date(b.date) - new Date(a.date)); + const latestPosts = normalizedPosts.slice(0, 4); + + const container = document.querySelector("#vf-news-container"); + if (!container) { + console.error("Container with ID #vf-news-container not found."); + return; + } + + container.innerHTML = ` + + `; + } + + fetchAndDisplayLatestProjects(); + }); + + '; + + echo $fetchPosts; + // Re-add wrappers after content + + } + + +else if($fetch == 'contenthub') { + if ($is_preview) { ?> +
+
+

+ +

+
+
+ + diff --git a/wp-content/plugins/vf-events/acf-json/group_5fbcab7c84d03.json b/wp-content/plugins/vf-events/acf-json/group_5fbcab7c84d03.json index 2ef3500bd..c8d37e59f 100644 --- a/wp-content/plugins/vf-events/acf-json/group_5fbcab7c84d03.json +++ b/wp-content/plugins/vf-events/acf-json/group_5fbcab7c84d03.json @@ -20,13 +20,15 @@ "default": "Default", "cco_hd": "CCO Heidelberg", "science_society": "Science and Society", - "trec_event": "TREC Events" + "trec_event": "TREC Events", + "public_engagement": "Public Engagement" }, "default_value": false, - "allow_null": 0, + "return_format": "value", "multiple": 0, + "allow_null": 0, + "allow_in_bindings": 1, "ui": 0, - "return_format": "value", "ajax": 0, "placeholder": "" }, @@ -183,8 +185,15 @@ [ { "field": "field_5fbcab958038b", - "operator": "!=", - "value": "trec_event" + "operator": "==", + "value": "cco_hd" + } + ], + [ + { + "field": "field_5fbcab958038b", + "operator": "==", + "value": "default" } ] ], @@ -206,11 +215,12 @@ "98": "Other" }, "default_value": [], - "allow_null": 0, + "return_format": "label", "multiple": 1, + "allow_null": 0, + "allow_in_bindings": 1, "ui": 1, "ajax": 0, - "return_format": "label", "placeholder": "" }, { @@ -265,6 +275,46 @@ "return_format": "label", "placeholder": "" }, + { + "key": "field_67b5c45853102", + "label": "Location", + "name": "vf_event_pb_location", + "aria-label": "", + "type": "select", + "instructions": "", + "required": 0, + "conditional_logic": [ + [ + { + "field": "field_5fbcab958038b", + "operator": "==", + "value": "public_engagement" + } + ] + ], + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "choices": { + "Barcelona": "Barcelona", + "EBI (Hinxton)": "EBI (Hinxton)", + "Grenoble": "Grenoble", + "Hamburg": "Hamburg", + "Heidelberg": "Heidelberg", + "Rome": "Rome", + "Other": "Other" + }, + "default_value": false, + "return_format": "label", + "multiple": 0, + "allow_null": 0, + "allow_in_bindings": 1, + "ui": 1, + "ajax": 0, + "placeholder": "" + }, { "key": "field_63fcbb7c22389", "label": "City TREC", @@ -359,18 +409,8 @@ [ { "field": "field_5fbcab958038b", - "operator": "!=", - "value": "science_society" - }, - { - "field": "field_5fbcab958038b", - "operator": "!=", - "value": "default" - }, - { - "field": "field_5fbcab958038b", - "operator": "!=", - "value": "trec_event" + "operator": "==", + "value": "cco_hd" } ] ], @@ -388,11 +428,12 @@ "other": "Other" }, "default_value": false, - "allow_null": 0, + "return_format": "array", "multiple": 0, + "allow_null": 0, + "allow_in_bindings": 1, "ui": 1, "ajax": 0, - "return_format": "array", "placeholder": "" }, { @@ -551,25 +592,18 @@ "type": "text", "instructions": "If empty the event type will be displayed", "required": 0, - "conditional_logic": [ - [ - { - "field": "field_5fbcab958038b", - "operator": "!=", - "value": "trec_event" - } - ] - ], + "conditional_logic": 0, "wrapper": { "width": "50", "class": "", "id": "" }, "default_value": "", + "maxlength": "", + "allow_in_bindings": 1, "placeholder": "", "prepend": "", - "append": "", - "maxlength": "" + "append": "" }, { "key": "field_5e9850b053db2", @@ -645,7 +679,7 @@ }, { "key": "field_63fc9b7bb133a", - "label": "Registration TREC", + "label": "Registration link", "name": "vf_event_trec_registration", "aria-label": "", "type": "url", @@ -666,6 +700,7 @@ "id": "" }, "default_value": "", + "allow_in_bindings": 1, "placeholder": "" }, { @@ -735,6 +770,13 @@ "operator": "==", "value": "cco_hd" } + ], + [ + { + "field": "field_5fbcab958038b", + "operator": "==", + "value": "public_engagement" + } ] ], "wrapper": { @@ -744,7 +786,8 @@ }, "display_format": "j M Y", "return_format": "j M Y", - "first_day": 1 + "first_day": 1, + "allow_in_bindings": 1 }, { "key": "field_61713b68f4311", @@ -761,6 +804,13 @@ "operator": "==", "value": "cco_hd" } + ], + [ + { + "field": "field_5fbcab958038b", + "operator": "==", + "value": "public_engagement" + } ] ], "wrapper": { @@ -769,10 +819,11 @@ "id": "" }, "default_value": "", + "maxlength": "", + "allow_in_bindings": 1, "placeholder": "", "prepend": "", - "append": "", - "maxlength": "" + "append": "" }, { "key": "field_61713b75f4312", @@ -789,6 +840,13 @@ "operator": "==", "value": "cco_hd" } + ], + [ + { + "field": "field_5fbcab958038b", + "operator": "==", + "value": "public_engagement" + } ] ], "wrapper": { @@ -797,10 +855,11 @@ "id": "" }, "default_value": "Register", + "maxlength": "", + "allow_in_bindings": 1, "placeholder": "", "prepend": "", - "append": "", - "maxlength": "" + "append": "" }, { "key": "field_61713d2a583ec", @@ -966,10 +1025,11 @@ "id": "" }, "default_value": "", + "maxlength": "", + "allow_in_bindings": 1, "placeholder": "", "prepend": "", - "append": "", - "maxlength": "" + "append": "" }, { "key": "field_5e98502253db0", @@ -1869,7 +1929,15 @@ "type": "tab", "instructions": "", "required": 0, - "conditional_logic": 0, + "conditional_logic": [ + [ + { + "field": "field_5fbcab958038b", + "operator": "==", + "value": "cco_hd" + } + ] + ], "wrapper": { "width": "", "class": "", @@ -1885,7 +1953,7 @@ "name": "vf_event_custom_faq", "aria-label": "", "type": "wysiwyg", - "instructions": "Leave 'empty' if there is no additional information to be added to the FAQ", + "instructions": "", "required": 0, "conditional_logic": 0, "wrapper": { @@ -1893,7 +1961,7 @@ "class": "", "id": "" }, - "default_value": "empty", + "default_value": "", "allow_in_bindings": 0, "tabs": "all", "toolbar": "full", diff --git a/wp-content/plugins/vf-events/templates/partials/event-info.php b/wp-content/plugins/vf-events/templates/partials/event-info.php index ebe690b54..f34159d0c 100644 --- a/wp-content/plugins/vf-events/templates/partials/event-info.php +++ b/wp-content/plugins/vf-events/templates/partials/event-info.php @@ -181,7 +181,12 @@ class="vf-button vf-button--tertiary vf-button--sm vf-u-margin__bottom--600">: Application: - + = $current_date) { echo esc_html($registration_closing_on_site); diff --git a/wp-content/themes/vf-wp-groups/acf-json/group_621c848f8d8cc.json b/wp-content/themes/vf-wp-groups/acf-json/group_621c848f8d8cc.json index 51f929db3..9e1438f8b 100644 --- a/wp-content/themes/vf-wp-groups/acf-json/group_621c848f8d8cc.json +++ b/wp-content/themes/vf-wp-groups/acf-json/group_621c848f8d8cc.json @@ -6,6 +6,7 @@ "key": "field_621c849c2ad18", "label": "Custom template", "name": "vf_groups_custom_blog_template", + "aria-label": "", "type": "true_false", "instructions": "", "required": 0, @@ -20,6 +21,78 @@ "ui": 1, "ui_on_text": "", "ui_off_text": "" + }, + { + "key": "field_67a1dcd7dc54b", + "label": "WP REST API 1", + "name": "wp_rest_api_1", + "aria-label": "", + "type": "url", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "default_value": "", + "allow_in_bindings": 0, + "placeholder": "" + }, + { + "key": "field_67a1dcf6dc54c", + "label": "WP REST API 2", + "name": "wp_rest_api_2", + "aria-label": "", + "type": "url", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "default_value": "", + "allow_in_bindings": 1, + "placeholder": "" + }, + { + "key": "field_67a1dcfcdc54d", + "label": "WP REST API 3", + "name": "wp_rest_api_3", + "aria-label": "", + "type": "url", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "default_value": "", + "allow_in_bindings": 1, + "placeholder": "" + }, + { + "key": "field_67a1dd710c148", + "label": "Custom endpoints", + "name": "", + "aria-label": "", + "type": "message", + "instructions": "", + "required": 0, + "conditional_logic": 0, + "wrapper": { + "width": "", + "class": "", + "id": "" + }, + "message": "Use the field below to customize the blogs feed", + "new_lines": "wpautop", + "esc_html": 0 } ], "location": [ @@ -39,6 +112,5 @@ "hide_on_screen": "", "active": true, "description": "", - "modified": 1646037185 - + "show_in_rest": 0 } \ No newline at end of file diff --git a/wp-content/themes/vf-wp-groups/index.php b/wp-content/themes/vf-wp-groups/index.php index 284f09b45..5cb28355d 100644 --- a/wp-content/themes/vf-wp-groups/index.php +++ b/wp-content/themes/vf-wp-groups/index.php @@ -15,7 +15,10 @@ $page_for_posts_id = get_option( 'page_for_posts' ); $title = $vf_theme->get_title(); $slug = get_page_by_path( 'blog' ); -$custom_template = get_field('vf_groups_custom_blog_template', $slug->ID); +$custom_template = get_field('vf_groups_custom_blog_template', $page_for_posts_id); +$endpoint1 = get_field('wp_rest_api_1', $page_for_posts_id); +$endpoint2 = get_field('wp_rest_api_2', $page_for_posts_id); +$endpoint3 = get_field('wp_rest_api_3', $page_for_posts_id); if ($custom_template) { if (class_exists('VF_WP_Hero_Blog')) { @@ -45,14 +48,136 @@ +
+ is_last_post()) { echo '
'; } + } } + else { + $fetchPosts = ' +'; + + echo $fetchPosts; + + + }?> +
+ diff --git a/wp-content/themes/vf-wp-groups/partials/sepe-filter.php b/wp-content/themes/vf-wp-groups/partials/sepe-filter.php new file mode 100644 index 000000000..7376011b4 --- /dev/null +++ b/wp-content/themes/vf-wp-groups/partials/sepe-filter.php @@ -0,0 +1,33 @@ + + +
+
+ Location + +
+ + + +
+ +
+
\ No newline at end of file diff --git a/wp-content/themes/vf-wp-groups/partials/vf-summary--pb-event.php b/wp-content/themes/vf-wp-groups/partials/vf-summary--pb-event.php new file mode 100644 index 000000000..a23d4ce0d --- /dev/null +++ b/wp-content/themes/vf-wp-groups/partials/vf-summary--pb-event.php @@ -0,0 +1,57 @@ + + +
+

+ + format('M') == $end->format('M')) { + echo $start->format('j'); ?> - format('j F Y'); } + else { + echo $start->format('j M'); ?> - format('j F Y'); } + } + else { + echo $start->format('j F Y'); + } } + if ($startTime) { + echo ', ' . $startTime; + } + if ($endTime) { + echo ' - '. $endTime . ' CET'; + } + ?> + + +

+

+ +

+ +
+
+ +
+ +

+

+ +
+ current_post +1 < $forthcomingLoop->post_count) { + echo '
'; + +} ?> +
diff --git a/wp-content/themes/vf-wp-groups/style.css b/wp-content/themes/vf-wp-groups/style.css index b622b4455..6df4b5cb5 100644 --- a/wp-content/themes/vf-wp-groups/style.css +++ b/wp-content/themes/vf-wp-groups/style.css @@ -24,4 +24,25 @@ ul li ul.children li { color: #111; } - \ No newline at end of file + .loader { + width: 48px; + height: 48px; + border: 5px solid #FFF; + border-bottom-color: rgb(59, 111, 182); + border-radius: 50%; + display: inline-block; + box-sizing: border-box; + animation: rotation 1s linear infinite; + } + + @keyframes rotation { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } + } + + \ No newline at end of file diff --git a/wp-content/themes/vf-wp-groups/template-sepe-events.php b/wp-content/themes/vf-wp-groups/template-sepe-events.php new file mode 100644 index 000000000..03a013510 --- /dev/null +++ b/wp-content/themes/vf-wp-groups/template-sepe-events.php @@ -0,0 +1,134 @@ + + +
+
+
+
+

+ +

+

EMBL organises and takes part in public engagement and outreach events across Europe.

+

Select the location to see details of all the events that happened there.

+
+ +
+ +
+
+
+ +
+
+
+
+ +
+
+ + +
+ 100, + 'post_type' => 'vf_event', + 'order' => 'ASC', + 'orderby' => 'meta_value_num', + 'meta_key' => 'vf_event_start_date', + 'meta_query' => [ + 'relation' => 'OR', + [ + 'key' => 'vf_event_start_date', + 'value' => $current_date, + 'compare' => '>=', + 'type' => 'numeric' + ], + [ + 'key' => 'vf_event_end_date', + 'value' => $current_date, + 'compare' => '>=', + 'type' => 'numeric' + ], + [ + 'key' => 'vf_event_start_date', + 'value' => date('Ymd', strtotime('now')), + 'type' => 'numeric', + 'compare' => '>=' + ] + ] + ]); + + while ($forthcomingLoop->have_posts()) : $forthcomingLoop->the_post(); + include locate_template('partials/vf-summary--pb-event.php', false, false); + endwhile; + wp_reset_postdata(); + ?> + +
+

+ No upcoming events found +

+
+ +
+
+
+
+ +
+
+ the_content(); ?> +
+
+
+ + + + + + + diff --git a/wp-content/themes/vf-wp/functions.php b/wp-content/themes/vf-wp/functions.php index 602665a60..e67bb8d93 100644 --- a/wp-content/themes/vf-wp/functions.php +++ b/wp-content/themes/vf-wp/functions.php @@ -509,6 +509,48 @@ function get_events_posts($request) { } } +/* +Register the custom REST API route to get all posts +*/ + +// /wp-json/custom/v1/all-posts/ + +add_action('rest_api_init', function () { + register_rest_route('custom/v1', '/all-posts/', array( + 'methods' => 'GET', + 'callback' => 'custom_api_get_all_posts', + )); +}); + +// Callback function to fetch all posts +function custom_api_get_all_posts($request) { + $args = array( + 'post_type' => 'post', + 'posts_per_page' => -1, // Fetch all posts + 'post_status' => 'publish', + ); + + $query = new WP_Query($args); + $posts = array(); + + if ($query->have_posts()) { + while ($query->have_posts()) { + $query->the_post(); + $posts[] = array( + 'title' => get_the_title(), + 'excerpt' => get_the_excerpt(), + 'date' => get_the_date(), + 'link' => get_permalink(), + 'featured_image_src' => get_the_post_thumbnail_url(get_the_ID(), 'full') + ); + } + wp_reset_postdata(); + } + + return rest_ensure_response($posts); +} + + diff --git a/wp-content/themes/vf-wp/functions/theme-block.php b/wp-content/themes/vf-wp/functions/theme-block.php index ab66b1a24..3254f0d8c 100644 --- a/wp-content/themes/vf-wp/functions/theme-block.php +++ b/wp-content/themes/vf-wp/functions/theme-block.php @@ -140,6 +140,7 @@ public function acf_init() { } // Setup render callback using VF Gutenberg plugin or fallback + $callback = function() { $args = func_get_args(); $template = $this->config['acf']['renderTemplate']; @@ -157,10 +158,24 @@ public function acf_init() { } else { $block = $args[0]; $is_preview = $args[2]; + + // Check if the block is 'acf/vfwp-card' + $is_vfwp_card = isset($block['name']) && $block['name'] === 'acf/vfwp-card'; + + // Add wrapper to disable link clicks only for 'acf/vfwp-card' in preview + if ($is_preview && $is_vfwp_card) { + echo '
'; + } + include($template); + + if ($is_preview && $is_vfwp_card) { + echo '
'; + } } }; + if ($json) { // Use modern block.json registration