about-widget.php
1 year ago
accordion-widget.php
1 year ago
accordion.php
1 year ago
attachment-url.php
1 year ago
audio.php
1 year ago
before-after.php
1 year ago
button.php
1 year ago
code.php
1 year ago
contact-box.php
1 year ago
contact-form.php
1 year ago
custom-list.php
6 months ago
divider.php
1 year ago
dropcap.php
1 year ago
facebook.php
1 year ago
flickr.php
1 year ago
gallery.php
1 year ago
gmap.php
1 year ago
highlight.php
1 year ago
image.php
1 year ago
instagram-feed.php
1 year ago
latest-posts-slider.php
1 year ago
popular-posts-widget.php
1 year ago
products-grid.php
1 year ago
quote.php
1 year ago
recent-posts-grid-carousel.php
1 year ago
recent-posts-land-style.php
1 year ago
recent-posts-masonry.php
1 year ago
recent-posts-tiles-carousel.php
1 year ago
recent-posts-tiles.php
1 year ago
recent-posts-timeline.php
1 year ago
recent-posts-widget.php
1 year ago
recent-products.php
1 year ago
related-posts.php
8 years ago
sample-element.php
1 year ago
search.php
1 year ago
socials-list.php
1 year ago
staff.php
1 year ago
tab-widget.php
1 year ago
tabs.php
1 year ago
testimonial.php
1 year ago
text.php
1 year ago
touch-slider.php
1 year ago
video.php
1 year ago
recent-posts-grid-carousel.php
1186 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Code highlighter element |
| 4 | * |
| 5 | * |
| 6 | * @package Auxin |
| 7 | * @license LICENSE.txt |
| 8 | * @author averta |
| 9 | * @link http://phlox.pro/ |
| 10 | * @copyright (c) 2010-2025 averta |
| 11 | */ |
| 12 | |
| 13 | function auxin_get_recent_posts_master_array( $master_array ) { |
| 14 | |
| 15 | $categories = get_terms([ |
| 16 | 'taxonomy' => 'category', |
| 17 | 'orderby' => 'count', |
| 18 | 'hide_empty' => false, |
| 19 | ]); |
| 20 | $categories_list = array( ' ' => __('All Categories', 'auxin-elements' ) ) ; |
| 21 | foreach ( $categories as $key => $value ) { |
| 22 | $categories_list[$value->term_id] = $value->name; |
| 23 | } |
| 24 | |
| 25 | // $tags = get_terms( 'post_tag', 'orderby=count&hide_empty=0' ); |
| 26 | // $tags_list; |
| 27 | // foreach ($tags as $key => $value) { |
| 28 | // $tags_list["$value->term_id"] = $value->name; |
| 29 | // } |
| 30 | |
| 31 | |
| 32 | $master_array['aux_recent_posts'] = array( |
| 33 | 'name' => __('Grid & Carousel Recent Posts', 'auxin-elements' ), |
| 34 | 'auxin_output_callback' => 'auxin_widget_recent_posts_callback', |
| 35 | 'base' => 'aux_recent_posts', |
| 36 | 'description' => __('It adds recent posts in grid or carousel mode.', 'auxin-elements' ), |
| 37 | 'class' => 'aux-widget-recent-posts', |
| 38 | 'show_settings_on_create' => true, |
| 39 | 'weight' => 1, |
| 40 | 'is_widget' => false, |
| 41 | 'is_shortcode' => true, |
| 42 | 'category' => THEME_NAME, |
| 43 | 'group' => '', |
| 44 | 'admin_enqueue_js' => '', |
| 45 | 'admin_enqueue_css' => '', |
| 46 | 'front_enqueue_js' => '', |
| 47 | 'front_enqueue_css' => '', |
| 48 | 'icon' => 'aux-element aux-pb-icons-grid', |
| 49 | 'custom_markup' => '', |
| 50 | 'js_view' => '', |
| 51 | 'html_template' => '', |
| 52 | 'deprecated' => '', |
| 53 | 'content_element' => '', |
| 54 | 'as_parent' => '', |
| 55 | 'as_child' => '', |
| 56 | 'params' => array( |
| 57 | array( |
| 58 | 'heading' => __('Title','auxin-elements' ), |
| 59 | 'description' => __('Recent post title, leave it empty if you don`t need title.', 'auxin-elements'), |
| 60 | 'param_name' => 'title', |
| 61 | 'type' => 'textfield', |
| 62 | 'value' => '', |
| 63 | 'holder' => 'textfield', |
| 64 | 'class' => 'title', |
| 65 | 'admin_label' => false, |
| 66 | 'dependency' => '', |
| 67 | 'weight' => '', |
| 68 | 'group' => '', |
| 69 | 'edit_field_class' => '' |
| 70 | ), |
| 71 | array( |
| 72 | 'heading' => __('Subtitle','auxin-elements' ), |
| 73 | 'description' => __('Recent posts subtitle, leave it empty if you don`t need title.', 'auxin-elements'), |
| 74 | 'param_name' => 'subtitle', |
| 75 | 'type' => 'textfield', |
| 76 | 'value' => '', |
| 77 | 'holder' => 'textfield', |
| 78 | 'class' => 'title', |
| 79 | 'admin_label' => false, |
| 80 | 'dependency' => '', |
| 81 | 'weight' => '', |
| 82 | 'group' => '', |
| 83 | 'edit_field_class' => '' |
| 84 | ), |
| 85 | array( |
| 86 | 'heading' => __('Categories', 'auxin-elements'), |
| 87 | 'description' => __('Specifies a category that you want to show posts from it.', 'auxin-elements' ), |
| 88 | 'param_name' => 'cat', |
| 89 | 'type' => 'aux_select2_multiple', |
| 90 | 'def_value' => ' ', |
| 91 | 'holder' => '', |
| 92 | 'class' => 'cat', |
| 93 | 'value' => $categories_list, |
| 94 | 'admin_label' => false, |
| 95 | 'dependency' => '', |
| 96 | 'weight' => '', |
| 97 | 'group' => __( 'Query', 'auxin-elements' ), |
| 98 | 'edit_field_class' => '' |
| 99 | ), |
| 100 | array( |
| 101 | 'heading' => __('Number of posts to show', 'auxin-elements'), |
| 102 | 'description' => '', |
| 103 | 'param_name' => 'num', |
| 104 | 'type' => 'textfield', |
| 105 | 'value' => '8', |
| 106 | 'holder' => '', |
| 107 | 'class' => 'num', |
| 108 | 'admin_label' => false, |
| 109 | 'dependency' => '', |
| 110 | 'weight' => '', |
| 111 | 'group' => __( 'Query', 'auxin-elements' ), |
| 112 | 'edit_field_class' => '' |
| 113 | ), |
| 114 | array( |
| 115 | 'heading' => __('Image aspect ratio', 'auxin-elements'), |
| 116 | 'description' => '', |
| 117 | 'param_name' => 'image_aspect_ratio', |
| 118 | 'type' => 'dropdown', |
| 119 | 'def_value' => '0.75', |
| 120 | 'holder' => '', |
| 121 | 'class' => 'order', |
| 122 | 'value' =>array ( |
| 123 | '0.75' => __('Horizontal 4:3' , 'auxin-elements'), |
| 124 | '0.56' => __('Horizontal 16:9', 'auxin-elements'), |
| 125 | '1.00' => __('Square 1:1' , 'auxin-elements'), |
| 126 | '1.33' => __('Vertical 3:4' , 'auxin-elements') |
| 127 | ), |
| 128 | 'admin_label' => false, |
| 129 | 'dependency' => '', |
| 130 | 'weight' => '', |
| 131 | 'group' => '', |
| 132 | 'edit_field_class' => '' |
| 133 | ), |
| 134 | array( |
| 135 | 'heading' => __('Exclude posts without media','auxin-elements' ), |
| 136 | 'description' => '', |
| 137 | 'param_name' => 'exclude_without_media', |
| 138 | 'type' => 'aux_switch', |
| 139 | 'value' => '0', |
| 140 | 'class' => '', |
| 141 | 'admin_label' => false, |
| 142 | 'dependency' => '', |
| 143 | 'weight' => '', |
| 144 | 'group' => __( 'Query', 'auxin-elements' ), |
| 145 | 'edit_field_class' => '' |
| 146 | ), |
| 147 | array( |
| 148 | 'heading' => __('Exclude custom post formats','auxin-elements' ), |
| 149 | 'description' => '', |
| 150 | 'param_name' => 'exclude_custom_post_formats', |
| 151 | 'type' => 'aux_switch', |
| 152 | 'value' => '0', |
| 153 | 'class' => '', |
| 154 | 'admin_label' => false, |
| 155 | 'dependency' => '', |
| 156 | 'weight' => '', |
| 157 | 'group' => __( 'Query', 'auxin-elements' ), |
| 158 | 'edit_field_class' => '' |
| 159 | ), |
| 160 | array( |
| 161 | 'heading' => __('Exclude quote and link post formats','auxin-elements' ), |
| 162 | 'description' => '', |
| 163 | 'param_name' => 'exclude_quote_link', |
| 164 | 'type' => 'aux_switch', |
| 165 | 'value' => '0', |
| 166 | 'class' => '', |
| 167 | 'admin_label' => false, |
| 168 | 'dependency' => array( |
| 169 | 'element' => 'exclude_custom_post_formats', |
| 170 | 'value' => array('0', 'false') |
| 171 | ), |
| 172 | 'weight' => '', |
| 173 | 'group' => '', |
| 174 | 'edit_field_class' => '' |
| 175 | ), |
| 176 | array( |
| 177 | 'heading' => __('Order by', 'auxin-elements'), |
| 178 | 'description' => '', |
| 179 | 'param_name' => 'order_by', |
| 180 | 'type' => 'dropdown', |
| 181 | 'def_value' => 'date', |
| 182 | 'holder' => '', |
| 183 | 'class' => 'order_by', |
| 184 | 'value' => array ( |
| 185 | 'date' => __('Date', 'auxin-elements'), |
| 186 | 'menu_order date' => __('Menu Order', 'auxin-elements'), |
| 187 | 'title' => __('Title', 'auxin-elements'), |
| 188 | 'ID' => __('ID', 'auxin-elements'), |
| 189 | 'rand' => __('Random', 'auxin-elements'), |
| 190 | 'comment_count' => __('Comments', 'auxin-elements'), |
| 191 | 'modified' => __('Date Modified', 'auxin-elements'), |
| 192 | 'author' => __('Author', 'auxin-elements'), |
| 193 | 'post__in' => __('Inserted Post IDs', 'auxin-elements') |
| 194 | ), |
| 195 | 'admin_label' => false, |
| 196 | 'dependency' => '', |
| 197 | 'weight' => '', |
| 198 | 'group' => __( 'Query', 'auxin-elements' ), |
| 199 | 'edit_field_class' => '' |
| 200 | ), |
| 201 | array( |
| 202 | 'heading' => __('Order', 'auxin-elements'), |
| 203 | 'description' => '', |
| 204 | 'param_name' => 'order', |
| 205 | 'type' => 'dropdown', |
| 206 | 'def_value' => 'DESC', |
| 207 | 'holder' => '', |
| 208 | 'class' => 'order', |
| 209 | 'value' =>array ( |
| 210 | 'DESC' => __('Descending', 'auxin-elements'), |
| 211 | 'ASC' => __('Ascending', 'auxin-elements'), |
| 212 | ), |
| 213 | 'admin_label' => false, |
| 214 | 'dependency' => '', |
| 215 | 'weight' => '', |
| 216 | 'group' => __( 'Query', 'auxin-elements' ), |
| 217 | 'edit_field_class' => '' |
| 218 | ), |
| 219 | array( |
| 220 | 'heading' => __('Only posts','auxin-elements' ), |
| 221 | 'description' => __('If you intend to display ONLY specific posts, you should specify the posts here. You have to insert the post IDs that are separated by comma (eg. 53,34,87,25).', 'auxin-elements' ), |
| 222 | 'param_name' => 'only_posts__in', |
| 223 | 'type' => 'textfield', |
| 224 | 'value' => '', |
| 225 | 'holder' => '', |
| 226 | 'class' => '', |
| 227 | 'admin_label' => false, |
| 228 | 'dependency' => '', |
| 229 | 'weight' => '', |
| 230 | 'group' => __( 'Query', 'auxin-elements' ), |
| 231 | 'edit_field_class' => '' |
| 232 | ), |
| 233 | array( |
| 234 | 'heading' => __('Include posts','auxin-elements' ), |
| 235 | 'description' => __('If you intend to include additional posts, you should specify the posts here. You have to insert the Post IDs that are separated by comma (eg. 53,34,87,25)', 'auxin-elements' ), |
| 236 | 'param_name' => 'include', |
| 237 | 'type' => 'textfield', |
| 238 | 'value' => '', |
| 239 | 'holder' => '', |
| 240 | 'class' => '', |
| 241 | 'admin_label' => false, |
| 242 | 'dependency' => '', |
| 243 | 'weight' => '', |
| 244 | 'group' => __( 'Query', 'auxin-elements' ), |
| 245 | 'edit_field_class' => '' |
| 246 | ), |
| 247 | array( |
| 248 | 'heading' => __('Exclude posts','auxin-elements' ), |
| 249 | 'description' => __('If you intend to exclude specific posts from result, you should specify the posts here. You have to insert the Post IDs that are separated by comma (eg. 53,34,87,25)', 'auxin-elements' ), |
| 250 | 'param_name' => 'exclude', |
| 251 | 'type' => 'textfield', |
| 252 | 'value' => '', |
| 253 | 'holder' => '', |
| 254 | 'class' => '', |
| 255 | 'admin_label' => false, |
| 256 | 'dependency' => '', |
| 257 | 'weight' => '', |
| 258 | 'group' => __( 'Query', 'auxin-elements' ), |
| 259 | 'edit_field_class' => '' |
| 260 | ), |
| 261 | array( |
| 262 | 'heading' => __('Start offset','auxin-elements' ), |
| 263 | 'description' => __('Number of post to displace or pass over.', 'auxin-elements' ), |
| 264 | 'param_name' => 'offset', |
| 265 | 'type' => 'textfield', |
| 266 | 'value' => '', |
| 267 | 'holder' => '', |
| 268 | 'class' => '', |
| 269 | 'admin_label' => false, |
| 270 | 'dependency' => '', |
| 271 | 'weight' => '', |
| 272 | 'group' => __( 'Query', 'auxin-elements' ), |
| 273 | 'edit_field_class' => '' |
| 274 | ), |
| 275 | array( |
| 276 | 'heading' => __('Display post media (image, video, etc)', 'auxin-elements' ), |
| 277 | 'param_name' => 'show_media', |
| 278 | 'type' => 'aux_switch', |
| 279 | 'def_value' => '', |
| 280 | 'value' => '1', |
| 281 | 'holder' => '', |
| 282 | 'class' => 'show_media', |
| 283 | 'admin_label' => false, |
| 284 | 'dependency' => '', |
| 285 | 'weight' => '', |
| 286 | 'group' => '', |
| 287 | 'edit_field_class' => '' |
| 288 | ), |
| 289 | array( |
| 290 | 'heading' => __('Display post title','auxin-elements' ), |
| 291 | 'description' => '', |
| 292 | 'param_name' => 'display_title', |
| 293 | 'type' => 'aux_switch', |
| 294 | 'value' => '1', |
| 295 | 'class' => 'display_title', |
| 296 | 'admin_label' => false, |
| 297 | 'dependency' => '', |
| 298 | 'weight' => '', |
| 299 | 'group' => '', |
| 300 | 'edit_field_class' => '' |
| 301 | ), |
| 302 | array( |
| 303 | 'heading' => __('Display post info','auxin-elements' ), |
| 304 | 'description' => '', |
| 305 | 'param_name' => 'show_info', |
| 306 | 'type' => 'aux_switch', |
| 307 | 'value' => '1', |
| 308 | 'class' => '', |
| 309 | 'admin_label' => false, |
| 310 | 'weight' => '', |
| 311 | 'group' => '', |
| 312 | 'edit_field_class' => '' |
| 313 | ), |
| 314 | array( |
| 315 | 'heading' => __('Display post content','auxin-elements' ), |
| 316 | 'description' => '', |
| 317 | 'param_name' => 'show_content', |
| 318 | 'type' => 'aux_switch', |
| 319 | 'value' => '1', |
| 320 | 'class' => '', |
| 321 | 'admin_label' => false, |
| 322 | 'weight' => '', |
| 323 | 'group' => '', |
| 324 | 'edit_field_class' => '' |
| 325 | ), |
| 326 | array( |
| 327 | 'heading' => __('Post info position', 'auxin-elements' ), |
| 328 | 'description' => '', |
| 329 | 'param_name' => 'post_info_position', |
| 330 | 'type' => 'dropdown', |
| 331 | 'def_value' => 'after-title', |
| 332 | 'holder' => '', |
| 333 | 'class' => 'post_info_position', |
| 334 | 'value' => array ( |
| 335 | 'after-title' => __('After Title' , 'auxin-elements' ), |
| 336 | 'before-title' => __('Before Title', 'auxin-elements' ) |
| 337 | ), |
| 338 | 'admin_label' => false, |
| 339 | 'dependency' => array( |
| 340 | 'element' => 'show_info', |
| 341 | 'value' => '1' |
| 342 | ), |
| 343 | 'weight' => '', |
| 344 | 'group' => '', |
| 345 | 'edit_field_class' => '' |
| 346 | ), |
| 347 | array( |
| 348 | 'heading' => __('Display Categories','auxin-elements' ), |
| 349 | 'description' => '', |
| 350 | 'param_name' => 'display_categories', |
| 351 | 'type' => 'aux_switch', |
| 352 | 'value' => '1', |
| 353 | 'holder' => '', |
| 354 | 'class' => 'display_categories', |
| 355 | 'admin_label' => false, |
| 356 | 'dependency' => array( |
| 357 | 'element' => 'show_info', |
| 358 | 'value' => '1' |
| 359 | ), |
| 360 | 'weight' => '', |
| 361 | 'group' => '', |
| 362 | 'edit_field_class' => '' |
| 363 | ), |
| 364 | array( |
| 365 | 'heading' => __('Display Date','auxin-elements' ), |
| 366 | 'description' => '', |
| 367 | 'param_name' => 'show_date', |
| 368 | 'type' => 'aux_switch', |
| 369 | 'value' => '1', |
| 370 | 'holder' => '', |
| 371 | 'class' => 'show_date', |
| 372 | 'admin_label' => false, |
| 373 | 'dependency' => array( |
| 374 | 'element' => 'show_info', |
| 375 | 'value' => '1' |
| 376 | ), |
| 377 | 'weight' => '', |
| 378 | 'group' => '', |
| 379 | 'edit_field_class' => '' |
| 380 | ), |
| 381 | array( |
| 382 | 'heading' => __('Display like button','auxin-elements' ), |
| 383 | 'description' => sprintf(__('Enable it to display %s like button%s on gride template blog. Please note WP Ulike plugin needs to be activaited to use this option.', 'auxin-elements'), '<strong>', '</strong>'), |
| 384 | 'param_name' => 'display_like', |
| 385 | 'type' => 'aux_switch', |
| 386 | 'value' => '1', |
| 387 | 'holder' => '', |
| 388 | 'class' => 'display_like', |
| 389 | 'admin_label' => false, |
| 390 | 'dependency' => '', |
| 391 | 'weight' => '', |
| 392 | 'group' => '', |
| 393 | 'edit_field_class' => '' |
| 394 | ), |
| 395 | array( |
| 396 | 'heading' => __('Load More Type','auxin-elements' ), |
| 397 | 'description' => '', |
| 398 | 'param_name' => 'loadmore_type', |
| 399 | 'type' => 'aux_visual_select', |
| 400 | 'value' => '', |
| 401 | 'class' => 'loadmore_type', |
| 402 | 'admin_label' => false, |
| 403 | 'dependency' => '', |
| 404 | 'weight' => '', |
| 405 | 'group' => '' , |
| 406 | 'edit_field_class' => '', |
| 407 | 'choices' => array( |
| 408 | '' => array( |
| 409 | 'label' => __('None', 'auxin-elements' ), |
| 410 | 'image' => AUXIN_URL . 'images/visual-select/load-more-none.svg' |
| 411 | ), |
| 412 | 'scroll' => array( |
| 413 | 'label' => __('Infinite Scroll', 'auxin-elements' ), |
| 414 | 'image' => AUXIN_URL . 'images/visual-select/load-more-infinite.svg' |
| 415 | ), |
| 416 | 'next' => array( |
| 417 | 'label' => __('Next Button', 'auxin-elements' ), |
| 418 | 'image' => AUXIN_URL . 'images/visual-select/load-more-button.svg' |
| 419 | ), |
| 420 | 'next-prev' => array( |
| 421 | 'label' => __('Next Prev', 'auxin-elements' ), |
| 422 | 'image' => AUXIN_URL . 'images/visual-select/load-more-next-prev.svg' |
| 423 | ) |
| 424 | ) |
| 425 | ), |
| 426 | array( |
| 427 | 'heading' => __('Excerpt length','auxin-elements' ), |
| 428 | 'description' => __('Specify summary content in character.','auxin-elements' ), |
| 429 | 'param_name' => 'excerpt_len', |
| 430 | 'type' => 'textfield', |
| 431 | 'value' => '160', |
| 432 | 'holder' => '', |
| 433 | 'class' => 'excerpt_len', |
| 434 | 'admin_label' => false, |
| 435 | 'dependency' => '', |
| 436 | 'weight' => '', |
| 437 | 'group' => '', |
| 438 | 'edit_field_class' => '' |
| 439 | ), |
| 440 | array( |
| 441 | 'heading' => __('Display author or read more', 'auxin-elements'), |
| 442 | 'description' => __('Specifies whether to show author or read more on each post.', 'auxin-elements'), |
| 443 | 'param_name' => 'author_or_readmore', |
| 444 | 'type' => 'dropdown', |
| 445 | 'def_value' => 'readmore', |
| 446 | 'holder' => '', |
| 447 | 'class' => 'author_or_readmore', |
| 448 | 'value' =>array ( |
| 449 | 'readmore' => __( 'Read More' , 'auxin-elements' ), |
| 450 | 'author' => __( 'Author Name', 'auxin-elements' ), |
| 451 | 'none' => __( 'None' , 'auxin-elements' ) |
| 452 | ), |
| 453 | 'admin_label' => false, |
| 454 | 'dependency' => '', |
| 455 | 'weight' => '', |
| 456 | 'group' => '', |
| 457 | 'edit_field_class' => '' |
| 458 | ), |
| 459 | array( |
| 460 | 'heading' => __('Meta Info position', 'auxin-elements' ), |
| 461 | 'description' => '', |
| 462 | 'param_name' => 'meta_info_position', |
| 463 | 'type' => 'dropdown', |
| 464 | 'def_value' => 'after-title', |
| 465 | 'holder' => '', |
| 466 | 'class' => 'meta_info_position', |
| 467 | 'value' => array ( |
| 468 | 'after-content' => __('After Content' , 'auxin-elements' ), |
| 469 | 'before-content' => __('Before Content', 'auxin-elements' ) |
| 470 | ), |
| 471 | 'admin_label' => false, |
| 472 | 'weight' => '', |
| 473 | 'group' => '', |
| 474 | 'edit_field_class' => '' |
| 475 | ), |
| 476 | array( |
| 477 | 'heading' => __('Number of columns', 'auxin-elements'), |
| 478 | 'description' => '', |
| 479 | 'param_name' => 'desktop_cnum', |
| 480 | 'type' => 'dropdown', |
| 481 | 'def_value' => '4', |
| 482 | 'holder' => '', |
| 483 | 'class' => 'num', |
| 484 | 'value' => array( |
| 485 | '1' => '1', '2' => '2', '3' => '3', |
| 486 | '4' => '4', '5' => '5', '6' => '6' |
| 487 | ), |
| 488 | 'admin_label' => false, |
| 489 | 'dependency' => '', |
| 490 | 'weight' => '', |
| 491 | 'group' => __( 'Layout', 'auxin-elements' ), |
| 492 | 'edit_field_class' => '' |
| 493 | ), |
| 494 | array( |
| 495 | 'heading' => __('Number of columns in tablet size', 'auxin-elements'), |
| 496 | 'description' => '', |
| 497 | 'param_name' => 'tablet_cnum', |
| 498 | 'type' => 'dropdown', |
| 499 | 'def_value' => 'inherit', |
| 500 | 'holder' => '', |
| 501 | 'class' => 'num', |
| 502 | 'value' => array( |
| 503 | 'inherit' => 'Inherited from larger', |
| 504 | '1' => '1', '2' => '2', '3' => '3', |
| 505 | '4' => '4', '5' => '5', '6' => '6' |
| 506 | ), |
| 507 | 'admin_label' => false, |
| 508 | 'dependency' => '', |
| 509 | 'weight' => '', |
| 510 | 'group' => __( 'Layout', 'auxin-elements' ), |
| 511 | 'edit_field_class' => '' |
| 512 | ), |
| 513 | array( |
| 514 | 'heading' => __('Number of columns in phone size', 'auxin-elements'), |
| 515 | 'description' => '', |
| 516 | 'param_name' => 'phone_cnum', |
| 517 | 'type' => 'dropdown', |
| 518 | 'def_value' => '1', |
| 519 | 'holder' => '', |
| 520 | 'class' => 'num', |
| 521 | 'value' => array( |
| 522 | '1' => '1', '2' => '2', '3' => '3' |
| 523 | ), |
| 524 | 'admin_label' => false, |
| 525 | 'dependency' => '', |
| 526 | 'weight' => '', |
| 527 | 'group' => __( 'Layout', 'auxin-elements' ), |
| 528 | 'edit_field_class' => '' |
| 529 | ), |
| 530 | array( |
| 531 | 'heading' => __('Display items as', 'auxin-elements'), |
| 532 | 'description' => '', |
| 533 | 'param_name' => 'preview_mode', |
| 534 | 'type' => 'dropdown', |
| 535 | 'def_value' => 'grid', |
| 536 | 'holder' => 'textfield', |
| 537 | 'class' => 'num', |
| 538 | 'value' => array( |
| 539 | 'grid' => __( 'Grid', 'auxin-elements' ), |
| 540 | 'grid-table' => __( 'Grid - Table Style', 'auxin-elements' ), |
| 541 | 'grid-modern' => __( 'Grid - Modern Style', 'auxin-elements' ), |
| 542 | 'carousel-modern'=> __( 'Carousel - Modern Style', 'auxin-elements' ), |
| 543 | 'carousel' => __( 'Carousel', 'auxin-elements' ) |
| 544 | ), |
| 545 | 'admin_label' => false, |
| 546 | 'dependency' => '', |
| 547 | 'weight' => '', |
| 548 | 'group' => '', |
| 549 | 'edit_field_class' => '' |
| 550 | ), |
| 551 | array( |
| 552 | 'heading' => __('Content layout', 'auxin-elements'), |
| 553 | 'description' => __('Specifies the style of content for each post column.', 'auxin-elements' ), |
| 554 | 'param_name' => 'content_layout', |
| 555 | 'type' => 'dropdown', |
| 556 | 'def_value' => 'default', |
| 557 | 'holder' => '', |
| 558 | 'class' => 'content_layout', |
| 559 | 'value' =>array ( |
| 560 | 'default' => __('Full Content', 'auxin-elements'), |
| 561 | 'entry-boxed' => __('Boxed Content', 'auxin-elements') |
| 562 | ), |
| 563 | 'admin_label' => false, |
| 564 | 'dependency' => array( |
| 565 | 'element' => 'preview_mode', |
| 566 | 'value' => array( 'grid', 'grid-table' ) |
| 567 | ), |
| 568 | 'weight' => '', |
| 569 | 'group' => '', |
| 570 | 'edit_field_class' => '' |
| 571 | ), |
| 572 | array( |
| 573 | 'heading' => __('Mouse Over Effect', 'auxin-elements'), |
| 574 | 'description' => '', |
| 575 | 'param_name' => 'grid_table_hover', |
| 576 | 'type' => 'dropdown', |
| 577 | 'def_value' => 'bgimage-bgcolor', |
| 578 | 'holder' => '', |
| 579 | 'class' => 'num', |
| 580 | 'value' => array( |
| 581 | 'bgcolor' => __( 'Background color', 'auxin-elements' ), |
| 582 | 'bgimage' => __( 'Cover image', 'auxin-elements' ), |
| 583 | 'bgimage-bgcolor' => __( 'Cover image or background color', 'auxin-elements' ), |
| 584 | 'none' => __( 'Nothing', 'auxin-elements' ) |
| 585 | ), |
| 586 | 'admin_label' => false, |
| 587 | 'dependency' => array( |
| 588 | 'element' => 'preview_mode', |
| 589 | 'value' => 'grid-table' |
| 590 | ), |
| 591 | 'weight' => '', |
| 592 | 'group' => '', |
| 593 | 'edit_field_class' => '' |
| 594 | ), |
| 595 | // Carousel Options |
| 596 | array( |
| 597 | 'heading' => __( 'Column space', 'auxin-elements' ), |
| 598 | 'description' => __( 'Specifies horizontal space between items (pixel).', 'auxin-elements' ), |
| 599 | 'param_name' => 'carousel_space', |
| 600 | 'type' => 'textfield', |
| 601 | 'value' => '30', |
| 602 | 'holder' => '', |
| 603 | 'class' => 'excerpt_len', |
| 604 | 'admin_label' => false, |
| 605 | 'dependency' => array( |
| 606 | 'element' => 'preview_mode', |
| 607 | 'value' => 'grid' |
| 608 | ), |
| 609 | 'weight' => '', |
| 610 | 'group' => '', |
| 611 | 'edit_field_class' => '' |
| 612 | ), |
| 613 | array( |
| 614 | 'heading' => __('Navigation type', 'auxin-elements'), |
| 615 | 'description' => '', |
| 616 | 'param_name' => 'carousel_navigation', |
| 617 | 'type' => 'dropdown', |
| 618 | 'def_value' => 'peritem', |
| 619 | 'holder' => '', |
| 620 | 'class' => 'num', |
| 621 | 'value' => array( |
| 622 | 'peritem' => __('Move per column', 'auxin-elements'), |
| 623 | 'perpage' => __('Move per page', 'auxin-elements'), |
| 624 | 'scroll' => __('Smooth scroll', 'auxin-elements'), |
| 625 | ), |
| 626 | 'admin_label' => false, |
| 627 | 'dependency' => array( |
| 628 | 'element' => 'preview_mode', |
| 629 | 'value' => array( 'carousel', 'carousel-modern' ) |
| 630 | ), |
| 631 | 'weight' => '', |
| 632 | 'group' => __( 'Carousel', 'auxin-elements' ), |
| 633 | 'edit_field_class' => '' |
| 634 | ), |
| 635 | array( |
| 636 | 'heading' => __('Navigation control', 'auxin-elements'), |
| 637 | 'description' => '', |
| 638 | 'param_name' => 'carousel_navigation_control', |
| 639 | 'type' => 'dropdown', |
| 640 | 'def_value' => 'bullets', |
| 641 | 'holder' => '', |
| 642 | 'class' => 'num', |
| 643 | 'value' => array( |
| 644 | 'arrows' => __('Arrows', 'auxin-elements'), |
| 645 | 'bullets' => __('Bullets', 'auxin-elements'), |
| 646 | '' => __('None', 'auxin-elements'), |
| 647 | ), |
| 648 | 'dependency' => array( |
| 649 | 'element' => 'preview_mode', |
| 650 | 'value' => array( 'carousel', 'carousel-modern' ) |
| 651 | ), |
| 652 | 'weight' => '', |
| 653 | 'admin_label' => false, |
| 654 | 'group' => __( 'Carousel', 'auxin-elements' ), |
| 655 | 'edit_field_class' => '' |
| 656 | ), |
| 657 | array( |
| 658 | 'heading' => __('Control Position', 'auxin-elements'), |
| 659 | 'description' => '', |
| 660 | 'param_name' => 'carousel_nav_control_pos', |
| 661 | 'type' => 'dropdown', |
| 662 | 'def_value' => 'center', |
| 663 | 'holder' => '', |
| 664 | 'value' => array( |
| 665 | 'center' => __('Center', 'auxin-elements'), |
| 666 | 'side' => __('Side', 'auxin-elements'), |
| 667 | ), |
| 668 | 'dependency' => array( |
| 669 | 'element' => 'carousel_navigation_control', |
| 670 | 'value' => 'arrows' |
| 671 | ), |
| 672 | 'weight' => '', |
| 673 | 'admin_label' => false, |
| 674 | 'group' => __( 'Carousel', 'auxin-elements' ), |
| 675 | 'edit_field_class' => '' |
| 676 | ), |
| 677 | array( |
| 678 | 'heading' => __('Control Skin', 'auxin-elements'), |
| 679 | 'description' => '', |
| 680 | 'param_name' => 'carousel_nav_control_skin', |
| 681 | 'type' => 'dropdown', |
| 682 | 'def_value' => 'boxed', |
| 683 | 'holder' => '', |
| 684 | 'value' => array( |
| 685 | 'boxed' => __('boxed', 'auxin-elements'), |
| 686 | 'long' => __('Long Arrow', 'auxin-elements'), |
| 687 | ), |
| 688 | 'dependency' => array( |
| 689 | 'element' => 'carousel_navigation_control', |
| 690 | 'value' => 'arrows' |
| 691 | ), |
| 692 | 'weight' => '', |
| 693 | 'admin_label' => false, |
| 694 | 'group' => __( 'Carousel', 'auxin-elements' ), |
| 695 | 'edit_field_class' => '' |
| 696 | ), |
| 697 | array( |
| 698 | 'heading' => __('Loop navigation','auxin-elements' ), |
| 699 | 'description' => '', |
| 700 | 'param_name' => 'carousel_loop', |
| 701 | 'type' => 'aux_switch', |
| 702 | 'value' => '1', |
| 703 | 'class' => '', |
| 704 | 'dependency' => array( |
| 705 | 'element' => 'preview_mode', |
| 706 | 'value' => array( 'carousel', 'carousel-modern' ) |
| 707 | ), |
| 708 | 'weight' => '', |
| 709 | 'group' => __( 'Carousel', 'auxin-elements' ), |
| 710 | 'edit_field_class' => '' |
| 711 | ), |
| 712 | array( |
| 713 | 'heading' => __('Autoplay carousel','auxin-elements' ), |
| 714 | 'description' => '', |
| 715 | 'param_name' => 'carousel_autoplay', |
| 716 | 'type' => 'aux_switch', |
| 717 | 'value' => '0', |
| 718 | 'class' => '', |
| 719 | 'admin_label' => false, |
| 720 | 'dependency' => array( |
| 721 | 'element' => 'preview_mode', |
| 722 | 'value' => array( 'carousel', 'carousel-modern' ) |
| 723 | ), |
| 724 | 'weight' => '', |
| 725 | 'group' => __( 'Carousel', 'auxin-elements' ), |
| 726 | 'edit_field_class' => '' |
| 727 | ), |
| 728 | array( |
| 729 | 'heading' => __('Autoplay delay','auxin-elements' ), |
| 730 | 'description' => __('Specifies the delay between auto-forwarding in seconds.', 'auxin-elements' ), |
| 731 | 'param_name' => 'carousel_autoplay_delay', |
| 732 | 'type' => 'textfield', |
| 733 | 'value' => '2', |
| 734 | 'holder' => '', |
| 735 | 'class' => 'excerpt_len', |
| 736 | 'admin_label' => false, |
| 737 | 'dependency' => array( |
| 738 | 'element' => 'preview_mode', |
| 739 | 'value' => array( 'carousel', 'carousel-modern' ) |
| 740 | ), |
| 741 | 'weight' => '', |
| 742 | 'group' => __( 'Carousel', 'auxin-elements' ), |
| 743 | 'edit_field_class' => '' |
| 744 | ), |
| 745 | array( |
| 746 | 'heading' => __('Extra class name','auxin-elements' ), |
| 747 | 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'auxin-elements' ), |
| 748 | 'param_name' => 'extra_classes', |
| 749 | 'type' => 'textfield', |
| 750 | 'value' => '', |
| 751 | 'def_value' => '', |
| 752 | 'holder' => '', |
| 753 | 'class' => 'extra_classes', |
| 754 | 'admin_label' => false, |
| 755 | 'dependency' => '', |
| 756 | 'weight' => '', |
| 757 | 'group' => '', |
| 758 | 'edit_field_class' => '' |
| 759 | ) |
| 760 | ) |
| 761 | ); |
| 762 | |
| 763 | return $master_array; |
| 764 | } |
| 765 | |
| 766 | add_filter( 'auxin_master_array_shortcodes', 'auxin_get_recent_posts_master_array', 10, 1 ); |
| 767 | |
| 768 | |
| 769 | |
| 770 | |
| 771 | /** |
| 772 | * Element without loop and column |
| 773 | * The front-end output of this element is returned by the following function |
| 774 | * |
| 775 | * @param array $atts The array containing the parsed values from shortcode, it should be same as defined params above. |
| 776 | * @param string $shortcode_content The shorcode content |
| 777 | * @return string The output of element markup |
| 778 | */ |
| 779 | function auxin_widget_recent_posts_callback( $atts, $shortcode_content = null ){ |
| 780 | |
| 781 | // Defining default attributes |
| 782 | $default_atts = array( |
| 783 | 'title' => '', // header title (required) |
| 784 | 'subtitle' => '', // header title (required) |
| 785 | 'cat' => ' ', |
| 786 | 'num' => '8', // max generated entry |
| 787 | 'only_posts__in' => '', // display only these post IDs. array or string comma separated |
| 788 | 'include' => '', // include these post IDs in result too. array or string comma separated |
| 789 | 'exclude' => '', // exclude these post IDs from result. array or string comma separated |
| 790 | 'offset' => '', |
| 791 | 'paged' => '', |
| 792 | 'post_type' => 'post', |
| 793 | 'taxonomy_name' => 'category', // the taxonomy that we intent to display in post info |
| 794 | 'order_by' => 'date', |
| 795 | 'order' => 'DESC', |
| 796 | |
| 797 | 'exclude_without_media' => 0, |
| 798 | 'exclude_custom_post_formats' => 0, |
| 799 | 'exclude_quote_link' => 0, |
| 800 | 'include_post_formats_in' => array(), // the list od post formats to exclude |
| 801 | 'exclude_post_formats_in' => array(), // the list od post formats to exclude |
| 802 | |
| 803 | 'size' => '', |
| 804 | 'display_title' => true, |
| 805 | 'words_num' => '', |
| 806 | 'show_media' => true, |
| 807 | 'display_like' => true, |
| 808 | 'display_comments' => true, |
| 809 | 'display_categories' => true, |
| 810 | 'max_taxonomy_num' => '', |
| 811 | 'show_badge' => false, |
| 812 | 'content_layout' => '', // entry-boxed |
| 813 | 'excerpt_len' => '160', |
| 814 | 'excerpt_length' => '', |
| 815 | 'show_excerpt' => true, |
| 816 | 'show_content' => true, |
| 817 | 'show_info' => true, |
| 818 | 'show_format_icon' => false, |
| 819 | 'show_date' => true, |
| 820 | 'ignore_formats' => false, |
| 821 | 'post_info_position' => 'after-title', |
| 822 | 'author_or_readmore' => 'readmore', // readmore, author, none |
| 823 | 'image_aspect_ratio' => 0.75, |
| 824 | 'meta_info_position' => 'after-content', |
| 825 | 'desktop_cnum' => 4, |
| 826 | 'tablet_cnum' => 'inherit', |
| 827 | 'phone_cnum' => '1', |
| 828 | 'preview_mode' => 'grid', |
| 829 | 'grid_table_hover' => 'bgimage-bgcolor', |
| 830 | 'tag' => '', |
| 831 | 'display_author_footer' => false, |
| 832 | 'display_author_header' => true, |
| 833 | |
| 834 | 'preloadable' => false, |
| 835 | 'preload_preview' => true, |
| 836 | 'preload_bgcolor' => '', |
| 837 | |
| 838 | 'extra_classes' => '', |
| 839 | 'extra_column_classes' => '', |
| 840 | 'custom_el_id' => '', |
| 841 | 'carousel_space' => '30', |
| 842 | 'carousel_autoplay' => false, |
| 843 | 'carousel_autoplay_delay' => '2', |
| 844 | 'carousel_navigation' => 'peritem', |
| 845 | 'carousel_navigation_control' => 'arrows', |
| 846 | 'carousel_nav_control_pos' => 'center', |
| 847 | 'carousel_nav_control_skin' => 'boxed', |
| 848 | 'carousel_loop' => 1, |
| 849 | 'request_from' => '', |
| 850 | 'template_part_file' => 'theme-parts/entry/post-column', |
| 851 | 'extra_template_path' => '', |
| 852 | |
| 853 | 'universal_id' => '', |
| 854 | 'use_wp_query' => false, // true to use the global wp_query, false to use internal custom query |
| 855 | 'reset_query' => true, |
| 856 | 'wp_query_args' => array(), // additional wp_query args |
| 857 | 'custom_wp_query' => '', |
| 858 | 'loadmore_type' => '', // 'next' (more button), 'scroll', 'next-prev' |
| 859 | 'loadmore_per_page' => '', |
| 860 | 'base' => 'aux_recent_posts', |
| 861 | 'base_class' => 'aux-widget-recent-posts' |
| 862 | ); |
| 863 | |
| 864 | $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content ); |
| 865 | extract( $result['parsed_atts'] ); |
| 866 | |
| 867 | $acceptedTemplateFiles = apply_filters( 'auxin_recent_posts_accepted_template_files', [ |
| 868 | 'theme-parts/entry/post-column', |
| 869 | 'theme-parts/entry/post-flip', |
| 870 | 'theme-parts/entry/post-land', |
| 871 | 'theme-parts/entry/post-tile', |
| 872 | 'theme-parts/entry/post', |
| 873 | 'woocommerce/content-product' |
| 874 | ]); |
| 875 | |
| 876 | if ( ! in_array( $template_part_file, $acceptedTemplateFiles ) ) { |
| 877 | return; |
| 878 | } |
| 879 | |
| 880 | // Validate the boolean variables |
| 881 | $exclude_without_media = auxin_is_true( $exclude_without_media ); |
| 882 | $display_like = auxin_is_true( $display_like ); |
| 883 | $display_title = auxin_is_true( $display_title ); |
| 884 | $show_info = auxin_is_true( $show_info ); |
| 885 | $display_author_footer = auxin_is_true( $display_author_footer ); |
| 886 | $display_author_header = auxin_is_true( $display_author_header ); |
| 887 | |
| 888 | // specify the post formats that should be excluded ------- |
| 889 | $exclude_post_formats_in = (array) $exclude_post_formats_in; |
| 890 | |
| 891 | if( auxin_is_true( $exclude_custom_post_formats ) ){ |
| 892 | $exclude_post_formats_in = array_merge( $exclude_post_formats_in, array( 'aside', 'gallery', 'image', 'link', 'quote', 'video', 'audio' ) ); |
| 893 | } |
| 894 | if( $exclude_quote_link ){ |
| 895 | $exclude_post_formats_in[] = 'quote'; |
| 896 | $exclude_post_formats_in[] = 'link'; |
| 897 | } |
| 898 | $exclude_post_formats_in = array_unique( $exclude_post_formats_in ); |
| 899 | |
| 900 | // -------------- |
| 901 | |
| 902 | ob_start(); |
| 903 | |
| 904 | $tax_args = array(); |
| 905 | if( ! empty( $cat ) && $cat != " " && ( ! is_array( $cat ) || ! in_array( " ", $cat ) ) ) { |
| 906 | $tax_args = array( |
| 907 | array( |
| 908 | 'taxonomy' => $taxonomy_name, |
| 909 | 'field' => 'term_id', |
| 910 | 'terms' => ! is_array( $cat ) ? explode( ",", $cat ) : $cat |
| 911 | ) |
| 912 | ); |
| 913 | } |
| 914 | |
| 915 | if( $custom_wp_query ){ |
| 916 | $wp_query = $custom_wp_query; |
| 917 | |
| 918 | } elseif( ! $use_wp_query ){ |
| 919 | |
| 920 | // create wp_query to get latest items --------------------------------- |
| 921 | $args = array( |
| 922 | 'post_type' => $post_type, |
| 923 | 'orderby' => $order_by, |
| 924 | 'order' => $order, |
| 925 | 'offset' => $offset, |
| 926 | 'paged' => $paged, |
| 927 | 'tax_query' => $tax_args, |
| 928 | 'post_status' => 'publish', |
| 929 | 'posts_per_page' => $num, |
| 930 | 'ignore_sticky_posts' => 1, |
| 931 | |
| 932 | 'include_posts__in' => $include, // include posts in this list |
| 933 | 'posts__not_in' => $exclude, // exclude posts in this list |
| 934 | 'posts__in' => $only_posts__in, // only posts in this list |
| 935 | |
| 936 | 'exclude_without_media' => $exclude_without_media, |
| 937 | 'exclude_post_formats_in' => $exclude_post_formats_in, |
| 938 | 'include_post_formats_in' => $include_post_formats_in |
| 939 | ); |
| 940 | |
| 941 | // --------------------------------------------------------------------- |
| 942 | |
| 943 | // add the additional query args if available |
| 944 | if( $wp_query_args ){ |
| 945 | $args = wp_parse_args( $wp_query_args, $args ); |
| 946 | } |
| 947 | |
| 948 | // pass the args through the auxin query parser |
| 949 | $wp_query = new WP_Query( auxin_parse_query_args( $args ) ); |
| 950 | } else { |
| 951 | global $wp_query; |
| 952 | } |
| 953 | |
| 954 | |
| 955 | // widget header ------------------------------ |
| 956 | echo wp_kses_post( $result['widget_header'] ); |
| 957 | echo wp_kses_post( $result['widget_title'] ); |
| 958 | |
| 959 | echo $subtitle ? '<h4 class="widget-subtitle">' . esc_html( $subtitle ) . '</h4>' : ''; |
| 960 | |
| 961 | |
| 962 | $phone_break_point = 767; |
| 963 | $tablet_break_point = 1025; |
| 964 | |
| 965 | $show_comments = true; // shows comments icon |
| 966 | $post_counter = 0; |
| 967 | $column_class = ''; |
| 968 | $item_class = 'aux-col'; |
| 969 | |
| 970 | $columns_custom_styles = ''; |
| 971 | |
| 972 | if( ! empty( $loadmore_type ) ) { |
| 973 | $item_class .= ' aux-ajax-item'; |
| 974 | } |
| 975 | |
| 976 | $tablet_cnum = ('inherit' == $tablet_cnum ) ? $desktop_cnum : $tablet_cnum ; |
| 977 | $phone_cnum = ('inherit' == $phone_cnum ) ? $tablet_cnum : $phone_cnum; |
| 978 | |
| 979 | if ( in_array( $preview_mode, array( 'grid', 'grid-table', 'grid-modern', 'flip' ) ) ) { |
| 980 | // generate columns class |
| 981 | $column_class = 'aux-match-height aux-row aux-de-col' . $desktop_cnum; |
| 982 | |
| 983 | $column_class .= ' aux-tb-col'.$tablet_cnum . ' aux-mb-col'.$phone_cnum . ' aux-total-'. $wp_query->post_count; |
| 984 | |
| 985 | $column_class .= 'entry-boxed' == $content_layout ? ' aux-entry-boxed' : ''; |
| 986 | |
| 987 | if ( 'flip' == $preview_mode ) { |
| 988 | $column_class .= ' aux-flip-box'; |
| 989 | } |
| 990 | |
| 991 | } elseif ( in_array( $preview_mode, array('carousel', 'carousel-modern') ) ) { |
| 992 | $column_class = 'master-carousel aux-no-js aux-mc-before-init' . ' aux-' . $carousel_nav_control_pos . '-control'; |
| 993 | $item_class = 'aux-mc-item'; |
| 994 | } |
| 995 | |
| 996 | if ( 'grid-table' == $preview_mode ) { |
| 997 | $column_class .= ' aux-grid-table-layout aux-border-collapse'; |
| 998 | $column_class .= 'none' != $grid_table_hover ? ' aux-has-bghover' : ''; |
| 999 | |
| 1000 | $show_media = false; |
| 1001 | } |
| 1002 | |
| 1003 | if ( in_array( $preview_mode, array('grid-modern', 'carousel-modern') ) ) { |
| 1004 | $column_class .= ' aux-grid-carousel-modern-layout'; |
| 1005 | } |
| 1006 | |
| 1007 | $ignore_formats = auxin_is_true( $ignore_formats ) ? array( '*' ) : array(); |
| 1008 | |
| 1009 | // Specifies whether the columns have footer meta or not |
| 1010 | $column_class .= 'none' === $author_or_readmore ? ' aux-no-meta' : ''; |
| 1011 | $column_class .= ' aux-ajax-view ' . $extra_column_classes; |
| 1012 | |
| 1013 | // automatically calculate the media size if was empty |
| 1014 | $column_media_width = auxin_get_content_column_width( $desktop_cnum, 15, $content_width ); |
| 1015 | if( empty( $size ) ){ |
| 1016 | $size = array( 'width' => $column_media_width, 'height' => $column_media_width * $image_aspect_ratio ); |
| 1017 | } |
| 1018 | |
| 1019 | $have_posts = $wp_query->have_posts(); |
| 1020 | |
| 1021 | if( $have_posts ){ |
| 1022 | |
| 1023 | if ( ! $skip_wrappers ) { |
| 1024 | if ( in_array( $preview_mode, array('carousel', 'carousel-modern') ) ) { |
| 1025 | echo sprintf( '<div data-element-id="%s" class="%s" data-same-height="true" data-wrap-controls="true" data-bullet-class="aux-bullets aux-small aux-mask" %s %s %s %s %s %s %s %s %s >', |
| 1026 | esc_attr( $universal_id ), |
| 1027 | esc_attr( $column_class ), |
| 1028 | 'data-columns="' . esc_attr( $desktop_cnum ) . '"', |
| 1029 | auxin_is_true( $carousel_autoplay ) ? ' data-autoplay="true"' : '', |
| 1030 | auxin_is_true( $carousel_autoplay ) ? ' data-delay="' . esc_attr( $carousel_autoplay_delay ) . '"' : '', |
| 1031 | 'data-navigation="' . esc_attr( $carousel_navigation ) . '"', |
| 1032 | 'data-space="' . esc_attr( $carousel_space ). '"', |
| 1033 | auxin_is_true( $carousel_loop ) ? ' data-loop="' . esc_attr( $carousel_loop ) . '"' : '', |
| 1034 | 'data-bullets="' . ('bullets' == $carousel_navigation_control ? 'true' : 'false') . '"', |
| 1035 | 'data-arrows="' . ('arrows' == $carousel_navigation_control ? 'true' : 'false') . '"', |
| 1036 | ( 'inherit' != $tablet_cnum || 'inherit' != $phone_cnum ) ? 'data-responsive="'. esc_attr( ( 'inherit' != $tablet_cnum ? $tablet_break_point . ':' . $tablet_cnum . ',' : '' ) . ( 'inherit' != $phone_cnum ? $phone_break_point . ':' . $phone_cnum : '' ) ) . '"' : '' |
| 1037 | ); |
| 1038 | } else { |
| 1039 | echo sprintf( '<div data-element-id="%s" class="%s">', esc_attr( $universal_id ), esc_attr( $column_class ) ); |
| 1040 | } |
| 1041 | } |
| 1042 | |
| 1043 | while ( $wp_query->have_posts() ) { |
| 1044 | |
| 1045 | $wp_query->the_post(); |
| 1046 | $post = get_post(); |
| 1047 | |
| 1048 | $post_vars = auxin_get_post_type_media_args( |
| 1049 | $post, |
| 1050 | array( |
| 1051 | 'post_type' => $post_type, |
| 1052 | 'request_from' => $request_from, |
| 1053 | 'media_width' => $phone_break_point, |
| 1054 | 'media_size' => $size, |
| 1055 | 'upscale_image' => true, |
| 1056 | 'image_from_content' => ! $exclude_without_media, // whether to try to get image from content or not |
| 1057 | 'no_gallery' => in_array( $preview_mode, array('carousel', 'carousel-modern') ), |
| 1058 | 'ignore_media' => ! $show_media, |
| 1059 | 'add_image_hw' => false, // whether add width and height attr or not |
| 1060 | 'preloadable' => $preloadable, |
| 1061 | 'preload_preview' => $preload_preview, |
| 1062 | 'preload_bgcolor' => $preload_bgcolor, |
| 1063 | 'image_sizes' => 'auto', |
| 1064 | 'srcset_sizes' => 'auto', |
| 1065 | 'ignore_formats' => $ignore_formats |
| 1066 | ), |
| 1067 | $content_width |
| 1068 | ); |
| 1069 | |
| 1070 | extract( $post_vars ); |
| 1071 | $the_format = get_post_format( $post ); |
| 1072 | |
| 1073 | // add specific class to current classes for each column |
| 1074 | $post_classes = $has_attach && $show_media ? 'post column-entry' : 'post column-entry no-media'; |
| 1075 | |
| 1076 | // generate custom inline style base on feature colors for each post if the preview mode is table cell |
| 1077 | if ( 'grid-table' == $preview_mode ) { |
| 1078 | |
| 1079 | $featured_color = ''; |
| 1080 | $featured_image = ''; |
| 1081 | |
| 1082 | if( false !== strpos( $grid_table_hover, 'bgcolor' ) ){ |
| 1083 | $featured_color = get_post_meta( $post->ID, 'auxin_featured_color_enabled', true ) ? get_post_meta( $post->ID, 'auxin_featured_color', true ) : |
| 1084 | auxin_get_option( 'post_single_featured_color' ); |
| 1085 | } |
| 1086 | if( false !== strpos( $grid_table_hover, 'bgimage' ) ){ |
| 1087 | $featured_image = auxin_get_the_attachment_url( $post, array( $column_media_width, $column_media_width ) ); |
| 1088 | } |
| 1089 | // if grid table hover effect was only bgcolor |
| 1090 | if( 'bgcolor' == $grid_table_hover ){ |
| 1091 | $columns_custom_styles .= $featured_color ? "\n.$base_class .aux-grid-table-layout > .post-{$post->ID}:hover { background-color:$featured_color; }" : ''; |
| 1092 | |
| 1093 | // if grid table hover effect was only bgimage |
| 1094 | } elseif( 'bgimage' == $grid_table_hover ){ |
| 1095 | $columns_custom_styles .= $featured_image ? "\n.$base_class .aux-grid-table-layout > .post-{$post->ID}:hover { background-image:linear-gradient( rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4) ), url( $featured_image ); }" : ''; |
| 1096 | |
| 1097 | // if grid table hover effect was bgimage with bgcolor fallback |
| 1098 | } elseif( 'bgimage-bgcolor' == $grid_table_hover ){ |
| 1099 | if( $featured_image ){ |
| 1100 | $columns_custom_styles .= "\n.$base_class .aux-grid-table-layout > .post-{$post->ID}:hover { background-image:linear-gradient( rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4) ), url( $featured_image ); }" ; |
| 1101 | } elseif( $featured_color ){ |
| 1102 | $columns_custom_styles .= "\n.$base_class .aux-grid-table-layout > .post-{$post->ID}:hover { background-color:$featured_color; }"; |
| 1103 | } |
| 1104 | } |
| 1105 | |
| 1106 | } |
| 1107 | |
| 1108 | $template_part_file = 'flip' === $preview_mode ? 'theme-parts/entry/post-flip' : $template_part_file; |
| 1109 | |
| 1110 | // Generate the markup by template parts |
| 1111 | if( has_action( $base_class . '-template-part' ) ){ |
| 1112 | do_action( $base_class . '-template-part', $result, $post_vars, $item_class ); |
| 1113 | |
| 1114 | } else { |
| 1115 | printf( '<div class="%s post-%s">', esc_attr( $item_class ), esc_attr( $post->ID ) ); |
| 1116 | include auxin_get_template_file( $template_part_file, '', $extra_template_path ); |
| 1117 | echo '</div>'; |
| 1118 | } |
| 1119 | |
| 1120 | } |
| 1121 | |
| 1122 | |
| 1123 | // Add the custom inline style if available |
| 1124 | if ( $columns_custom_styles ) { |
| 1125 | wp_add_inline_style( 'auxin-inline-styles', $columns_custom_styles ); |
| 1126 | } |
| 1127 | |
| 1128 | if ( in_array( $preview_mode, array('carousel', 'carousel-modern') ) && 'arrows' == $carousel_navigation_control ) { |
| 1129 | if ( 'boxed' === $carousel_nav_control_skin ) :?> |
| 1130 | <div class="aux-carousel-controls"> |
| 1131 | <div class="aux-next-arrow aux-arrow-nav aux-outline aux-hover-fill"> |
| 1132 | <span class="aux-svg-arrow aux-small-right"></span> |
| 1133 | <span class="aux-hover-arrow aux-white aux-svg-arrow aux-small-right"></span> |
| 1134 | </div> |
| 1135 | <div class="aux-prev-arrow aux-arrow-nav aux-outline aux-hover-fill"> |
| 1136 | <span class="aux-svg-arrow aux-small-left"></span> |
| 1137 | <span class="aux-hover-arrow aux-white aux-svg-arrow aux-small-left"></span> |
| 1138 | </div> |
| 1139 | </div> |
| 1140 | <?php else : ?> |
| 1141 | <div class="aux-carousel-controls"> |
| 1142 | <div class="aux-next-arrow"> |
| 1143 | <span class="aux-svg-arrow aux-l-right"></span> |
| 1144 | </div> |
| 1145 | <div class="aux-prev-arrow"> |
| 1146 | <span class="aux-svg-arrow aux-l-left"></span> |
| 1147 | |
| 1148 | </div> |
| 1149 | </div> |
| 1150 | <?php endif; |
| 1151 | } |
| 1152 | |
| 1153 | if( ! $skip_wrappers ) { |
| 1154 | // End tag for aux-ajax-view wrapper |
| 1155 | echo '</div>'; |
| 1156 | // Execute load more functionality |
| 1157 | if( ! in_array( $preview_mode, array('carousel', 'carousel-modern') ) && $wp_query->found_posts > $loadmore_per_page ) { |
| 1158 | echo auxin_get_load_more_controller( $loadmore_type ); |
| 1159 | } |
| 1160 | |
| 1161 | } else { |
| 1162 | // Get post counter in the query |
| 1163 | echo '<span class="aux-post-count hidden">'.esc_html( $wp_query->post_count ).'</span>'; |
| 1164 | echo '<span class="aux-all-posts-count hidden">'.esc_html( $wp_query->found_posts ).'</span>'; |
| 1165 | |
| 1166 | } |
| 1167 | |
| 1168 | } |
| 1169 | |
| 1170 | |
| 1171 | if( $reset_query ){ |
| 1172 | wp_reset_postdata(); |
| 1173 | } |
| 1174 | |
| 1175 | // return false if no result found |
| 1176 | if( ! $have_posts ){ |
| 1177 | ob_get_clean(); |
| 1178 | return false; |
| 1179 | } |
| 1180 | |
| 1181 | // widget footer ------------------------------ |
| 1182 | echo wp_kses_post( $result['widget_footer'] ); |
| 1183 | |
| 1184 | return ob_get_clean(); |
| 1185 | } |
| 1186 |