PluginProbe
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs / 5.0.1
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs v5.0.1
5.0.1 4.1.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.1.2 2.5.0 2.5.3 All 39 releases
blockspare / inc / block-posts-config / tax-category.php

tax-category.php in BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs 5.0.1, at inc/block-posts-config/tax-category.php

57 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!function_exists('blockspare_get_cat_tax_tags')) {
3 function blockspare_get_cat_tax_tags($taxType, $post_id, $post_type = '')
4 {
5
6
7 if ('post' == $post_type) {
8
9 if($taxType == 'category' || $taxType == ''){
10 $categories_list = get_the_category_list(' ', '', $post_id);
11 if ($categories_list) {
12 /* translators: 1: list of categories. */
13 printf(esc_html__('%1$s', 'blockspare'), $categories_list); // WPCS: XSS OK.
14 }
15 }
16 else if($taxType == 'post_tag' ){
17 $taxonomy = $taxType; // this is the name of the taxonomy
18
19 $terms = get_the_terms($post_id,$taxonomy);
20
21 if($terms){
22 foreach ( $terms as $term_item ) {?>
23 <a href="" class="category tag" ><?php echo $term_item->name; ?></a>
24 <?php }
25
26 }
27 }else{
28 $taxonomy = $taxType;
29 $terms = get_the_terms($post_id,$taxonomy);
30
31 if($terms){
32 foreach ( $terms as $term_item ) {?>
33 <a href="" class="category tag" ><?php echo $term_item->name; ?></a>
34 <?php }
35
36 }
37 }
38 } else {
39
40 $taxonomies = get_object_taxonomies($post_type, 'objects');
41
42
43 foreach ($taxonomies as $term_slug => $terms) {
44 if (!$terms->public || !$terms->show_ui) {
45 continue;
46 }
47 $terms = get_the_terms($post_id, $term_slug);
48 if ($terms) {
49 foreach ($terms as $term_key => $term_item) { ?>
50 <a href="" class="category tag"><?php echo $term_item->name; ?></a>
51 <?php }
52 }
53 }
54 }
55 }
56 }
57