From 142d36f83c847c423fbf17063896a42d84d4a615 Mon Sep 17 00:00:00 2001 From: KhadijaMahanga Date: Wed, 15 Jan 2020 09:41:25 +0300 Subject: [PATCH 1/3] remove Geography from post list --- wp-content/themes/hurumap/functions.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/wp-content/themes/hurumap/functions.php b/wp-content/themes/hurumap/functions.php index c0c49585..a87a4be5 100644 --- a/wp-content/themes/hurumap/functions.php +++ b/wp-content/themes/hurumap/functions.php @@ -111,16 +111,6 @@ function post_object_field_result($title, $post, $field, $post_id) } add_filter('acf/fields/post_object/result', 'post_object_field_result', 10, 4); add_filter('acf/fields/relationship/result', 'post_object_field_result', 10, 5); -/* - * Add geography column label to posts list - */ -function add_geography_column_label($columns) -{ - //add geography label to existing column array - $columns['geography'] = __('Geography'); - return $columns; -} -add_filter('manage_posts_columns', 'add_geography_column_label'); /* * Add bidirectional link between profile section and topic From c6488038640d32e51aa1ff92b723093b5ec1c2ea Mon Sep 17 00:00:00 2001 From: KhadijaMahanga Date: Wed, 15 Jan 2020 09:51:02 +0300 Subject: [PATCH 2/3] use category names to append in post title --- wp-content/themes/hurumap/functions.php | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/wp-content/themes/hurumap/functions.php b/wp-content/themes/hurumap/functions.php index a87a4be5..bda037e9 100644 --- a/wp-content/themes/hurumap/functions.php +++ b/wp-content/themes/hurumap/functions.php @@ -84,29 +84,17 @@ function post_object_field_query($args, $field, $post_id) // filter for every field add_filter('acf/fields/post_object/query', 'post_object_field_query', 10, 3); /** - * Preppend Geography Name on topic pages and profile pages + * Preppend Category Name on topic pages and profile pages * Topic and Section titles often repeat for geographies * Assists in selection */ function post_object_field_result($title, $post, $field, $post_id) { - $geography_list = (object) [ - 'burkina-faso' => 'Burkina Faso', - 'democratic-republic-congo' => 'DR Congo', - 'ethiopia' => 'Ethiopia', - 'kenya' => 'Kenya', - 'nigeria' => 'Nigeria', - 'senegal' => 'Senegal', - 'south-africa' => 'South Africa', - 'tanzania' => 'Tanzania', - 'uganda' => 'Uganda', - 'zambia' => 'Zambia' - ]; - //get geography of the post - $geography_slug = get_field('geography', $post->ID); - $geography = $geography_list->$geography_slug; - // append post geography to each post result - $title = $geography . ' : ' . $title; + //get category of the post + $category_name = get_the_category($post->ID)[0]->name ; + + // append post category country to each post result + $title = $category_name . ' : ' . $title; return $title; } add_filter('acf/fields/post_object/result', 'post_object_field_result', 10, 4); From e0894e33ac2a1d1f64e003f02e800aaf3e89008f Mon Sep 17 00:00:00 2001 From: KhadijaMahanga Date: Wed, 15 Jan 2020 09:58:42 +0300 Subject: [PATCH 3/3] delete geography acf field --- .../hurumap/acf-json/group_5d91f54751c13.json | 78 ------------------- 1 file changed, 78 deletions(-) delete mode 100644 wp-content/themes/hurumap/acf-json/group_5d91f54751c13.json diff --git a/wp-content/themes/hurumap/acf-json/group_5d91f54751c13.json b/wp-content/themes/hurumap/acf-json/group_5d91f54751c13.json deleted file mode 100644 index 1b9c1169..00000000 --- a/wp-content/themes/hurumap/acf-json/group_5d91f54751c13.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "key": "group_5d91f54751c13", - "title": "Geography", - "fields": [ - { - "key": "field_5d93620ba4710", - "label": "Geography", - "name": "geography", - "type": "select", - "instructions": "", - "required": 1, - "conditional_logic": 0, - "wrapper": { - "width": "", - "class": "", - "id": "" - }, - "choices": { - "burkina-faso": "Burkina Faso", - "democratic-republic-congo": "DR Congo", - "ethiopia": "Ethiopia", - "kenya": "Kenya", - "nigeria": "Nigeria", - "senegal": "Senegal", - "south-africa": "South Africa", - "tanzania": "Tanzania", - "uganda": "Uganda", - "zambia": "Zambia" - }, - "default_value": [], - "allow_null": 0, - "multiple": 0, - "ui": 0, - "return_format": "value", - "ajax": 0, - "placeholder": "" - } - ], - "location": [ - [ - { - "param": "post_type", - "operator": "==", - "value": "topic_page" - } - ], - [ - { - "param": "post_type", - "operator": "==", - "value": "profile_section_page" - } - ], - [ - { - "param": "post_type", - "operator": "==", - "value": "carousel_topic" - } - ], - [ - { - "param": "post_type", - "operator": "==", - "value": "profile" - } - ] - ], - "menu_order": 0, - "position": "acf_after_title", - "style": "default", - "label_placement": "left", - "instruction_placement": "label", - "hide_on_screen": "", - "active": 1, - "description": "", - "modified": 1573045002 -} \ No newline at end of file