get_primary_term()) ? $primary_term->get_primary_term() : false; if ($primary_cat_id) { foreach ($cat_list_cat as $key => $category) { if ($category->term_id == $primary_cat_id ) { $primary_cat = $category; unset($cat_list_cat[$key] ); array_unshift($cat_list_cat, $primary_cat ); break; } } } } // Limit the quantity $limit_cat = get_theme_mod('airinblog_cus_cat_meta_item_cat', 2); $cat_list_cat = array_slice($cat_list_cat, 0, $limit_cat ); // Label $cat_label_cat = ''; if ($cat_label_tax_none == 1) { $cat_label_cat = esc_html__('Categories', 'airin-blog').':'; } // Create links $limit_cat_array = array_map(function($category) { return sprintf( '%s', esc_url(get_category_link($category->term_id)), esc_html($category->name) ); }, $cat_list_cat); // Output echo '
'. '
' . esc_html($cat_label_cat) . ' '. implode(', ', $limit_cat_array). '
'. '
'; } } // Meta tax tag (in cat) if (get_theme_mod('airinblog_cus_cat_meta_activ_tag', 1) == 1) { $cat_list_tag = get_the_tag_list('','d1y2w3'); if (!empty($cat_list_tag)) { $limit_tag = get_theme_mod('airinblog_cus_cat_meta_item_tag', 3); $tag_array = explode('d1y2w3', $cat_list_tag); $limit_tag_array = array_slice($tag_array, 0, $limit_tag); $cat_label_tag = ''; if ($cat_label_tax_none == 1) { $cat_label_tag = esc_html__('Tags', 'airin-blog').':'; } echo '
'. '
' . esc_html($cat_label_tag) . ' '. implode(', ', $limit_tag_array). '
'. '
'; } } } } // Meta tags (post) if (get_theme_mod('airinblog_cus_post_meta', 1) == 1) { // Meta tags (in post) function airinblog_fun_posted_on_single() { $post_label_none = esc_attr(get_theme_mod('airinblog_cus_post_meta_label_block', 0)); // Functional - post reading time if (!function_exists('airinblog_fun_post_time_words')) { function airinblog_fun_post_time_words() { $words_per_minutes = 300; $content_text = is_single() ? get_the_content() : get_post(get_the_ID())->post_content; $minutes = round(count(preg_split('/\s/', $content_text)) / $words_per_minutes); if ($minutes == 0) { return esc_html_e('Less 1 min', 'airin-blog'); } else { return $minutes . ' ' . esc_html__('min', 'airin-blog'); } } } ?>
get_primary_term()) ? $primary_term->get_primary_term() : false; if ($primary_cat_id) { foreach ($post_list_cat as $key => $category) { if ($category->term_id == $primary_cat_id ) { $primary_cat = $category; unset($post_list_cat[$key] ); array_unshift($post_list_cat, $primary_cat ); break; } } } } // Limit the quantity $limit_cat = get_theme_mod('airinblog_cus_post_meta_item_cat', 5); $post_list_cat = array_slice($post_list_cat, 0, $limit_cat ); // Label $post_label_cat = ''; if (get_theme_mod('airinblog_cus_post_meta_label_tax', 0) != 1) { $post_label_cat = esc_html__('Categories', 'airin-blog').':'; } // Create links $limit_cat_array = array_map(function($category) { return sprintf( '%s', esc_url(get_category_link($category->term_id)), esc_html($category->name) ); }, $post_list_cat); // Output echo '
'. '
' . esc_html($post_label_cat) . ' '. implode(', ', $limit_cat_array). '
'. '
'; } } // Tags (in post) function airinblog_fun_post_meta_tax_tag() { $post_list_tag = get_the_tag_list('','d1y2w3'); if (!empty($post_list_tag)) { $limit_tag = get_theme_mod('airinblog_cus_post_meta_item_tag', 10); $tag_array = explode('d1y2w3', $post_list_tag); $limit_tag_array = array_slice($tag_array, 0, $limit_tag); $post_label_tag = ''; if (get_theme_mod('airinblog_cus_post_meta_label_tax', 0) != 1) { $post_label_tag = esc_html__('Tags', 'airin-blog').':'; } echo '
'. '
' . esc_html($post_label_tag) . ' '. implode(', ', $limit_tag_array). '
'. '
'; } } function airinblog_fun_post_meta_tax($lay) { if (get_theme_mod('airinblog_cus_post_meta_cat', 1) == 1) { $lay_cat = get_theme_mod('airinblog_cus_post_meta_layout_cat', 'top'); if ($lay == $lay_cat) { airinblog_fun_post_meta_tax_cat(); } } if (get_theme_mod('airinblog_cus_post_meta_tag', 1) == 1) { $lay_tag = get_theme_mod('airinblog_cus_post_meta_layout_tag', 'bottom'); if ($lay == $lay_tag) { airinblog_fun_post_meta_tax_tag(); } } } } // Data processing function airinblog_fun_categorized_blog() { if (false === ($trans_cat = get_transient('airinblog_transient_categories'))) { $trans_cat = get_categories(array( 'fields' => 'ids', 'hide_empty' => 1, 'number' => 2, )); $trans_cat = count($trans_cat); set_transient('airinblog_transient_categories', $trans_cat); } if ($trans_cat > 1) { return true; } else { return false; } } function airinblog_fun_tag_cat_transient() { if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } delete_transient('airinblog_transient_categories'); } add_action('edit_category', 'airinblog_fun_tag_cat_transient'); add_action('save_post', 'airinblog_fun_tag_cat_transient');