PluginProbe
Post Grid Gutenberg Blocks – PostX / 5.1.1
Post Grid Gutenberg Blocks – PostX v5.1.1
5.1.1 5.1.0 5.0.41 5.0.39 5.0.38 5.0.37 5.0.36 5.0.35 5.0.34 5.0.33 5.0.32 5.0.31 5.0.30 5.0.29 5.0.28 5.0.27 5.0.26 5.0.25 5.0.23 5.0.24 5.0.22 5.0.21 5.0.20 5.0.19 5.0.18 All 240 releases
ultimate-post / blocks / template / category.php

category.php in Post Grid Gutenberg Blocks – PostX 5.1.1, at blocks/template/category.php

45 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) || exit;
3 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Included inside block render methods; variables are local.
4
5 $attr['catStyle'] = sanitize_html_class( $attr['catStyle'] );
6 $attr['catPosition'] = sanitize_html_class( $attr['catPosition'] );
7
8 $category = '';
9 if ( $attr['catShow'] ) {
10 $category .= '<div class="ultp-category-grid ultp-category-' . $attr['catStyle'] . ' ultp-category-' . $attr['catPosition'] . '">';
11 $category .= '<div class="ultp-category-in' . ( $attr['customCatColor'] == true ? ' ultp-cat-color-' . $attr['customCatColor'] : '' ) . '">';
12 $cat = get_the_terms( $post_id, $attr['taxonomy'] );
13 if ( ! empty( $cat ) ) {
14 $max_tax = isset( $attr['maxTaxonomy'] ) && $attr['maxTaxonomy'] ? ( $attr['maxTaxonomy'] == '0' ? 0 : $attr['maxTaxonomy'] ) : 30;
15
16 foreach ( $cat as $k => $val ) {
17 if ( $k >= $max_tax ) {
18 break; }
19 $color = '';
20 if ( isset( $attr['customCatColor'] ) ) {
21 if ( $attr['customCatColor'] ) {
22 $color = ultimate_post()->get_term_color( $val );
23 $color = $color == 1 ? '#CE2746' : $color;
24 if ( isset( $attr['onlyCatColor'] ) ) {
25 if ( $attr['onlyCatColor'] ) {
26 $color = 'style="color: ' . ( $color ? $color : '#CE2746' ) . '"';
27 } else {
28 $color = 'style="background-color: ' . ( $color ? $color : '#CE2746' ) . ';"';
29 }
30 } else {
31 $color = 'style="background-color: ' . ( $color ? $color : '#CE2746' ) . ';"';
32 }
33 }
34 }
35 if ( $attr['onlyCatColor'] ) {
36 $category .= '<a class="ultp-cat-' . $val->slug . '" href="' . get_term_link( $val->term_id ) . '" ' . $color . ' ' . ( $attr['openInTab'] ? 'target="_blank"' : '' ) . '>' . $val->name . '</a>';
37 } else {
38 $category .= '<a class="ultp-cat-' . $val->slug . ( $attr['customCatColor'] == true ? ' ultp-cat-only-color-' . $attr['customCatColor'] : '' ) . '" href="' . get_term_link( $val->term_id ) . '" ' . $color . ' ' . ( $attr['openInTab'] ? 'target="_blank"' : '' ) . '>' . $val->name . '</a>';
39 }
40 }
41 }
42 $category .= '</div>';
43 $category .= '</div>';
44 }
45