PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.2.0
Forumax – AI Powered Advanced Community Forum Plugin v2.2.0
2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 2.0.0 2.1.0 All 29 releases
← All changes | includes/Blocks/Render/forums.php +11 -136 trunk2.2.0 View file →
@@ -9,9 +9,9 @@
9 9 if ( ! wp_script_is( 'bbpc-ajax', 'registered' ) ) {
10 10 wp_register_script( 'bbpc-ajax', FORUMAX_FRONT_ASS . 'js/ajax.js', array( 'jquery' ), FORUMAX_VERSION, true );
11 11 }
12 12 if ( ! wp_style_is( 'bbpc-el-widgets', 'registered' ) ) {
13 - wp_register_style( 'bbpc-el-widgets', FORUMAX_STYLES . 'frontend/el-widgets.css', array(), FORUMAX_VERSION );
13 + wp_register_style( 'bbpc-el-widgets', FORUMAX_FRONT_ASS . 'css/el-widgets.css' );
14 14 }
15 15
16 16 wp_enqueue_script( 'bbpc-ajax' );
17 17 wp_enqueue_style( 'bbpc-el-widgets' );
@@ -35,9 +35,8 @@
35 35 $enable_card_hover = isset( $attributes['enable_card_hover'] ) ? (bool) $attributes['enable_card_hover'] : true;
36 36 $mobile_columns = ! empty( $attributes['mobile_columns'] ) ? absint( $attributes['mobile_columns'] ) : 1;
37 37 $hide_image_mobile = isset( $attributes['hide_image_mobile'] ) ? (bool) $attributes['hide_image_mobile'] : false;
38 38
39 - $layout = ! empty( $attributes['layout'] ) ? $attributes['layout'] : 'default';
40 39 $unique_id = uniqid( 'bbpc-forums-' );
41 40
42 41 // Enforce free defaults when Pro is not active.
43 42 $is_pro_active = function_exists( 'forumax_is_premium' ) && forumax_is_premium();
@@ -69,140 +68,18 @@
69 68 }
70 69
71 70 $forums = new WP_Query( $query_args );
72 71
73 - // ---- Help Center Cards layout ----------------------------------------
74 - if ( 'help-center' === $layout ) {
75 - $show_excerpt = true; // Always show excerpt in Help Center (matches Elementor template).
76 - ob_start();
77 - ?>
78 - <div id="<?php echo esc_attr( $unique_id ); ?>" class="bbpc-hc-wrap">
79 - <?php if ( $forums->have_posts() ) : ?>
80 - <div class="bbpc-hc-grid">
81 - <?php
82 - while ( $forums->have_posts() ) :
83 - $forums->the_post();
84 - $item_id = get_the_ID();
85 - ?>
86 - <a href="<?php echo esc_url( get_the_permalink() ); ?>" class="bbpc-hc-card">
87 - <?php if ( $show_forum_image && has_post_thumbnail( $item_id ) ) : ?>
88 - <div class="bbpc-hc-icon">
89 - <?php the_post_thumbnail( array( 48, 48 ) ); ?>
90 - </div>
91 - <?php endif; ?>
92 - <div class="bbpc-hc-body">
93 - <h3 class="bbpc-hc-title"><?php echo esc_html( get_the_title() ); ?></h3>
94 - <?php
95 - $excerpt = get_the_excerpt();
96 - if ( $show_excerpt && $excerpt ) :
97 - ?>
98 - <p class="bbpc-hc-desc"><?php echo esc_html( wp_trim_words( $excerpt, 18, '…' ) ); ?></p>
99 - <?php endif; ?>
100 - <span class="bbpc-hc-count"><?php echo esc_html( bbp_get_forum_topic_count( $item_id ) ); ?> <?php esc_html_e( 'articles', 'bbp-core' ); ?></span>
101 - </div>
102 - <i class="eicon-arrow-right bbpc-hc-arrow" aria-hidden="true"></i>
103 - </a>
104 - <?php endwhile; ?>
105 - <?php wp_reset_postdata(); ?>
106 - </div>
107 -
108 - <?php else : ?>
109 - <div class="alert alert-warning"><?php echo esc_html( $no_posts_message ); ?></div>
110 - <?php endif; ?>
111 -
112 - <?php
113 - $styles = '';
114 - $id = '#' . esc_attr( $unique_id );
115 -
116 - // Grid columns.
117 - if ( $columns ) {
118 - $styles .= "{$id} .bbpc-hc-grid { grid-template-columns: repeat({$columns}, 1fr); }";
119 - }
120 -
121 - // Card gap.
122 - if ( ! empty( $settings['card_gap'] ) ) {
123 - $gap = absint( $settings['card_gap'] );
124 - $styles .= "{$id} .bbpc-hc-grid { gap: {$gap}px !important; }";
125 - }
126 -
127 - // Card background.
128 - if ( ! empty( $settings['card_bg_color'] ) ) {
129 - $color = $sanitize_css( $settings['card_bg_color'] );
130 - $styles .= "{$id} .bbpc-hc-card { background-color: {$color} !important; }";
131 - }
132 -
133 - // Card border radius.
134 - if ( ! empty( $settings['card_border_radius'] ) ) {
135 - $radius = absint( $settings['card_border_radius'] );
136 - $styles .= "{$id} .bbpc-hc-card { border-radius: {$radius}px !important; }";
137 - }
138 -
139 - // Title color.
140 - if ( ! empty( $settings['title_color'] ) ) {
141 - $color = $sanitize_css( $settings['title_color'] );
142 - $styles .= "{$id} .bbpc-hc-title { color: {$color} !important; }";
143 - }
144 -
145 - // Title hover color.
146 - if ( ! empty( $settings['title_hover_color'] ) ) {
147 - $color = $sanitize_css( $settings['title_hover_color'] );
148 - $styles .= "{$id} .bbpc-hc-card:hover .bbpc-hc-title { color: {$color} !important; }";
149 - }
150 -
151 - // Content color.
152 - if ( ! empty( $settings['content_color'] ) ) {
153 - $color = $sanitize_css( $settings['content_color'] );
154 - $styles .= "{$id} .bbpc-hc-desc, {$id} .bbpc-hc-count { color: {$color} !important; }";
155 - }
156 -
157 - // Title font size.
158 - if ( ! empty( $settings['title_font_size'] ) ) {
159 - $size = absint( $settings['title_font_size'] );
160 - $styles .= "{$id} .bbpc-hc-title { font-size: {$size}px !important; }";
161 - }
162 -
163 - // Meta font size.
164 - if ( ! empty( $settings['meta_font_size'] ) ) {
165 - $size = absint( $settings['meta_font_size'] );
166 - $styles .= "{$id} .bbpc-hc-desc, {$id} .bbpc-hc-count { font-size: {$size}px !important; }";
167 - }
168 -
169 - // Hover animation disabled.
170 - if ( ! $enable_card_hover ) {
171 - $styles .= "{$id} .bbpc-hc-card:hover { background: inherit !important; }";
172 - $styles .= "{$id} .bbpc-hc-arrow { opacity: 0 !important; transform: none !important; }";
173 - }
174 -
175 - // Responsive: mobile columns.
176 - if ( $mobile_columns || $hide_image_mobile ) {
177 - $styles .= "@media (max-width: 768px) {";
178 - if ( $mobile_columns ) {
179 - $styles .= "{$id} .bbpc-hc-grid { grid-template-columns: repeat({$mobile_columns}, 1fr) !important; }";
180 - }
181 - if ( $hide_image_mobile ) {
182 - $styles .= "{$id} .bbpc-hc-icon { display: none !important; }";
183 - }
184 - $styles .= "}";
185 - }
186 -
187 - // Output styles.
188 - if ( ! empty( $styles ) ) {
189 - echo '<style>' . $styles . '</style>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
190 - }
191 - ?>
192 - </div>
193 - <?php
194 - return ob_get_clean();
195 - }
196 - // ---- End Help Center Cards layout ------------------------------------
197 -
198 - $query_args2 = $query_args;
72 +
73 + $query_args2 = $query_args;
199 74 $query_args2['posts_per_page'] = $ppp2;
200 75 $query_args2['offset'] = $ppp;
201 76 $forums2 = new WP_Query( $query_args2 );
202 77
78 +
203 79 $hover_class = $enable_card_hover ? ' wow fadeInRight' : '';
204 80
81 +
205 82 $svg_minus = '<svg fill="currentColor" width="16px" height="16px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="icon line-color icon_minus"><line x1="19" y1="12" x2="5" y2="12" style="fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2;"></line></svg>';
206 83 $svg_plus = '<svg fill="currentColor" width="16px" height="16px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" class="icon line-color icon_plus"><path d="M5,12H19M12,5V19" style="fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2;"></path></svg>';
207 84
208 85 ob_start();
@@ -210,16 +87,14 @@
210 87 <div id="<?php echo esc_attr( $unique_id ); ?>">
211 88 <?php if ( $forums->have_posts() ) : ?>
212 89 <div class="communities-boxes">
213 90 <?php
214 - $delay = 0.1;
215 91 while ( $forums->have_posts() ) :
216 92 $forums->the_post();
217 93 $item_id = get_the_ID();
218 94 ?>
219 - <div class="com-box<?php echo esc_attr( $hover_class ); ?>" data-wow-delay="<?php echo esc_attr( $delay ); ?>s">
220 - <?php $delay += 0.1; ?>
221 - <?php if ( $show_forum_image && get_the_post_thumbnail( get_the_ID(), $forum_image_size ) ) : ?>
95 + <div class="com-box<?php echo esc_attr( $hover_class ); ?>" data-wow-delay="0.5s">
96 + <?php if ( $show_forum_image ) : ?>
222 97 <div class="icon-container">
223 98 <?php the_post_thumbnail( $forum_image_size ); ?>
224 99 </div>
225 100 <?php endif; ?>
@@ -264,9 +139,9 @@
264 139 $forums2->the_post();
265 140 $item_id = get_the_ID();
266 141 ?>
267 142 <div class="com-box">
268 - <?php if ( $show_forum_image && get_the_post_thumbnail( get_the_ID(), $forum_image_size ) ) : ?>
143 + <?php if ( $show_forum_image ) : ?>
269 144 <div class="icon-container">
270 145 <?php the_post_thumbnail( $forum_image_size ); ?>
271 146 </div>
272 147 <?php endif; ?>
@@ -310,10 +185,10 @@
310 185 $id = '#' . esc_attr( $unique_id );
311 186
312 187
313 188 if ( $columns ) {
314 - $styles .= "{$id} .communities-boxes { display: grid; grid-template-columns: repeat({$columns}, 1fr); margin: 0; width: 100%; }";
315 - $styles .= "{$id} .communities-boxes .com-box { width: 100%; flex: none; margin-bottom: 0; }";
189 + $styles .= "{$id} .communities-boxes { display: grid !important; grid-template-columns: repeat({$columns}, 1fr) !important; margin: 0 !important; width: 100% !important; }";
190 + $styles .= "{$id} .communities-boxes .com-box { width: 100% !important; flex: none !important; margin-bottom: 0 !important; }";
316 191 }
317 192
318 193 // Card gap.
319 194 if ( ! empty( $settings['card_gap'] ) ) {
@@ -407,10 +282,10 @@
407 282 }
408 283
409 284 // Output styles.
410 285 if ( ! empty( $styles ) ) {
411 - echo '<style>' . $styles . '</style>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
286 + echo '<style>' . $styles . '</style>';
412 287 }
413 288
414 289 return ob_get_clean();
415 290 }
416 291 }