diff --git a/includes/iotcat_elements.php b/includes/iotcat_elements.php index f72d990..74cc033 100644 --- a/includes/iotcat_elements.php +++ b/includes/iotcat_elements.php @@ -66,6 +66,7 @@ function create_post_type() { $args = array( 'labels' => $labels, + 'taxonomies' => array('post_tag'), 'public' => true, 'exclude_from_search' => false, 'publicly_queryable' => true, @@ -114,6 +115,19 @@ private function get_website_link($website){ } + private function get_tags_input($tags_path){ + $tag_input = array(); + if(isset($tags_path) && $tags_path !== null){ + foreach($tags_path as $tag_path){ + if(count($tag_path)>0){ + $tag_name = $tag_path[0]["name"]; + array_push($tag_input,$tag_name); + } + } + } + return $tag_input; + } + private function get_tags_elements($tags_path){ $html = ""; if(isset($tags_path) && $tags_path !== null){ @@ -306,10 +320,13 @@ public function delete_subscription_elements($subscription_id){ private function create_post_element($id, $name, $description,$website, $embedded_url, $image_url,$tags_path,$original_id,$subscription_id,$last_update_timestamp){ + + $element = array( 'post_title' => $name, 'post_status' => 'publish', 'post_content' => $this->get_page_content($name,$description,$website,$embedded_url, $image_url,$tags_path), + 'tags_input' => $this->get_tags_input($tags_path), 'post_type' => $this->post_type, 'meta_input' => array( "description" => $description, diff --git a/index.php b/index.php index dd99eb0..3b31265 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ /** * Plugin Name: IoT Catalogue Integration * Description: Display in WordPress content from IoT Catalogue - * Version: 1.2.0 + * Version: 1.3.0 * Author: UNPARALLEL Innovation, Lda * Author URI: https://www.unparallel.pt */