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