about-widget.php
9 years ago
accordion-api.php
9 years ago
accordion.php
9 years ago
attachment-url.php
9 years ago
audio.php
9 years ago
button.php
9 years ago
code.php
9 years ago
contact-box.php
9 years ago
contact-form.php
9 years ago
divider.php
9 years ago
dropcap.php
9 years ago
facebook.php
9 years ago
flickr.php
9 years ago
gallery.php
9 years ago
gmap.php
9 years ago
highlight.php
9 years ago
image.php
9 years ago
instagram-feed.php
9 years ago
latest-items.php
9 years ago
latest-posts-slider.php
9 years ago
popular-posts-widget.php
9 years ago
quote.php
9 years ago
recent-posts-grid-carousel.php
9 years ago
recent-posts-land-style.php
9 years ago
recent-posts-masonry.php
9 years ago
recent-posts-tiles.php
9 years ago
recent-posts-timeline.php
9 years ago
recent-posts-widget.php
9 years ago
recent-posts.php
9 years ago
sample-element.php
9 years ago
search.php
9 years ago
socials-list.php
9 years ago
tabs-api.php
9 years ago
tabs.php
9 years ago
text.php
9 years ago
video.php
9 years ago
recent-posts.php
861 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Code highlighter element |
| 4 | * |
| 5 | * |
| 6 | * @package auxin-elements |
| 7 | * @license LICENSE.txt |
| 8 | * @author |
| 9 | * @link https://bitbucket.org/averta/ |
| 10 | * @copyright (c) 2010-2016 |
| 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' => __('[Phlox] 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' => 'auxin-element auxin-code', |
| 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 | 'std' => '', |
| 61 | 'value' => '', |
| 62 | 'holder' => 'textfield', |
| 63 | 'class' => 'title', |
| 64 | 'admin_label' => true, |
| 65 | 'dependency' => '', |
| 66 | 'weight' => '', |
| 67 | 'group' => '' , |
| 68 | 'edit_field_class' => '' |
| 69 | ), |
| 70 | // array( |
| 71 | // 'param_name' => 'post_type', |
| 72 | // 'type' => 'dropdown', |
| 73 | // 'def_value' => 'post', |
| 74 | // 'value' => array( |
| 75 | // 'post' => __('Posts', 'auxin-elements' ), |
| 76 | // 'page' => __('Pages', 'auxin-elements' ), |
| 77 | // ), |
| 78 | // 'holder' => 'dropdown', |
| 79 | // 'class' => 'border', |
| 80 | // 'heading' => __('Create items from','auxin-elements' ), |
| 81 | // 'description' => '', |
| 82 | // 'admin_label' => true, |
| 83 | // 'dependency' => '', |
| 84 | // 'weight' => '', |
| 85 | // 'group' => '' , |
| 86 | // 'edit_field_class' => '' |
| 87 | // ), |
| 88 | |
| 89 | array( |
| 90 | 'param_name' => 'cat', |
| 91 | 'type' => 'dropdown', |
| 92 | 'def_value' => '', |
| 93 | 'holder' => 'dropdown', |
| 94 | 'class' => 'cat', |
| 95 | 'heading' => __('Categories', 'auxin-elements'), |
| 96 | 'description' => __('Specifies a category that you want to show posts from it.', 'auxin-elements' ), |
| 97 | 'value' => $categories_list, |
| 98 | 'admin_label' => true, |
| 99 | 'dependency' => '', |
| 100 | 'weight' => '', |
| 101 | 'group' => '' , |
| 102 | 'edit_field_class' => '' |
| 103 | ), |
| 104 | |
| 105 | array( |
| 106 | 'heading' => __('Number of posts to show', 'auxin-elements'), |
| 107 | 'description' => '', |
| 108 | 'param_name' => 'num', |
| 109 | 'type' => 'textfield', |
| 110 | 'def_value' => '8', |
| 111 | 'holder' => 'textfield', |
| 112 | 'class' => 'num', |
| 113 | 'admin_label' => true, |
| 114 | 'dependency' => '', |
| 115 | 'weight' => '', |
| 116 | 'group' => '' , |
| 117 | 'edit_field_class' => '' |
| 118 | ), |
| 119 | |
| 120 | array( |
| 121 | 'heading' => __('Exclude posts without media','auxin-elements' ), |
| 122 | 'description' => '', |
| 123 | 'param_name' => 'exclude_without_media', |
| 124 | 'type' => 'aux_switch', |
| 125 | 'value' => '0', |
| 126 | 'class' => '', |
| 127 | 'admin_label' => true, |
| 128 | 'dependency' => '', |
| 129 | 'weight' => '', |
| 130 | 'group' => '' , |
| 131 | 'edit_field_class' => '' |
| 132 | ), |
| 133 | |
| 134 | array( |
| 135 | 'heading' => __('Exclude custom post formats','auxin-elements' ), |
| 136 | 'description' => '', |
| 137 | 'param_name' => 'exclude_custom_post_formats', |
| 138 | 'type' => 'aux_switch', |
| 139 | 'value' => '0', |
| 140 | 'class' => '', |
| 141 | 'admin_label' => true, |
| 142 | 'dependency' => '', |
| 143 | 'weight' => '', |
| 144 | 'group' => '' , |
| 145 | 'edit_field_class' => '' |
| 146 | ), |
| 147 | |
| 148 | array( |
| 149 | 'heading' => __('Exclude qoute and link post formats','auxin-elements' ), |
| 150 | 'description' => '', |
| 151 | 'param_name' => 'exclude_qoute_link', |
| 152 | 'type' => 'aux_switch', |
| 153 | 'value' => '0', |
| 154 | 'class' => '', |
| 155 | 'admin_label' => true, |
| 156 | 'dependency' => array( |
| 157 | 'element' => 'exclude_custom_post_formats', |
| 158 | 'value' => '0' |
| 159 | ), |
| 160 | 'weight' => '', |
| 161 | 'group' => '' , |
| 162 | 'edit_field_class' => '' |
| 163 | ), |
| 164 | |
| 165 | array( |
| 166 | 'heading' => __('Exclude posts','auxin-elements' ), |
| 167 | 'description' => __('Post IDs separated by comma (eg. 53,34,87,25)', 'auxin-elements' ), |
| 168 | 'param_name' => 'exclude', |
| 169 | 'type' => 'textfield', |
| 170 | 'value' => '', |
| 171 | 'holder' => 'textfield', |
| 172 | 'class' => '', |
| 173 | 'admin_label' => true, |
| 174 | 'dependency' => '', |
| 175 | 'weight' => '', |
| 176 | 'group' => '' , |
| 177 | 'edit_field_class' => '' |
| 178 | ), |
| 179 | array( |
| 180 | 'heading' => __('Include posts','auxin-elements' ), |
| 181 | 'description' => __('Post IDs separated by comma (eg. 53,34,87,25)', 'auxin-elements' ), |
| 182 | 'param_name' => 'include', |
| 183 | 'type' => 'textfield', |
| 184 | 'value' => '', |
| 185 | 'holder' => 'textfield', |
| 186 | 'class' => '', |
| 187 | 'admin_label' => true, |
| 188 | 'dependency' => '', |
| 189 | 'weight' => '', |
| 190 | 'group' => '' , |
| 191 | 'edit_field_class' => '' |
| 192 | ), |
| 193 | array( |
| 194 | 'heading' => __('Order By', 'auxin-elements'), |
| 195 | 'description' => '', |
| 196 | 'param_name' => 'order_by', |
| 197 | 'type' => 'dropdown', |
| 198 | 'def_value' => 'date', |
| 199 | 'holder' => 'dropdown', |
| 200 | 'class' => 'order_by', |
| 201 | 'value' => array ( |
| 202 | 'date' => __('Date', 'auxin-elements'), |
| 203 | 'menu_order date' => __('Menu Order', 'auxin-elements'), |
| 204 | 'title' => __('Title', 'auxin-elements'), |
| 205 | 'ID' => __('ID', 'auxin-elements'), |
| 206 | 'rand' => __('Random', 'auxin-elements'), |
| 207 | 'comment_count' => __('Comments', 'auxin-elements'), |
| 208 | 'modified' => __('Date Modified', 'auxin-elements'), |
| 209 | 'author' => __('Author', 'auxin-elements'), |
| 210 | ), |
| 211 | 'admin_label' => true, |
| 212 | 'dependency' => '', |
| 213 | 'weight' => '', |
| 214 | 'group' => '' , |
| 215 | 'edit_field_class' => '' |
| 216 | ), |
| 217 | array( |
| 218 | 'heading' => __('Order', 'auxin-elements'), |
| 219 | 'description' => '', |
| 220 | 'param_name' => 'order', |
| 221 | 'type' => 'dropdown', |
| 222 | 'def_value' => 'DESC', |
| 223 | 'holder' => 'dropdown', |
| 224 | 'class' => 'order', |
| 225 | 'value' =>array ( |
| 226 | 'DESC' => __('Descending', 'auxin-elements'), |
| 227 | 'ASC' => __('Ascending', 'auxin-elements'), |
| 228 | ), |
| 229 | 'admin_label' => true, |
| 230 | 'dependency' => '', |
| 231 | 'weight' => '', |
| 232 | 'group' => '' , |
| 233 | 'edit_field_class' => '' |
| 234 | ), |
| 235 | |
| 236 | array( |
| 237 | 'heading' => __('Start offset','auxin-elements' ), |
| 238 | 'description' => __('Number of post to displace or pass over.', 'auxin-elements' ), |
| 239 | 'param_name' => 'offset', |
| 240 | 'type' => 'textfield', |
| 241 | 'value' => '', |
| 242 | 'holder' => 'textfield', |
| 243 | 'class' => '', |
| 244 | 'admin_label' => true, |
| 245 | 'dependency' => '', |
| 246 | 'weight' => '', |
| 247 | 'group' => '' , |
| 248 | 'edit_field_class' => '' |
| 249 | ), |
| 250 | |
| 251 | array( |
| 252 | 'heading' => __('Display post media (image, video, etc)', 'auxin-elements' ), |
| 253 | 'param_name' => 'show_media', |
| 254 | 'type' => 'aux_switch', |
| 255 | 'def_value' => '', |
| 256 | 'value' => '1', |
| 257 | 'holder' => 'dropdown', |
| 258 | 'class' => 'show_media', |
| 259 | 'admin_label' => true, |
| 260 | 'dependency' => '', |
| 261 | 'weight' => '', |
| 262 | 'group' => '' , |
| 263 | 'edit_field_class' => '' |
| 264 | ), |
| 265 | |
| 266 | array( |
| 267 | 'heading' => __('Image Aspect Ratio', 'auxin-elements'), |
| 268 | 'description' => '', |
| 269 | 'param_name' => 'image_aspect_ratio', |
| 270 | 'type' => 'dropdown', |
| 271 | 'def_value' => '0.75', |
| 272 | 'holder' => 'dropdown', |
| 273 | 'class' => 'order', |
| 274 | 'value' =>array ( |
| 275 | '0.75' => __('Horizontal 4:3' , 'auxin-elements'), |
| 276 | '0.56' => __('Horizontal 16:9', 'auxin-elements'), |
| 277 | '1.00' => __('Square 1:1' , 'auxin-elements'), |
| 278 | '1.33' => __('Vertical 3:4' , 'auxin-elements') |
| 279 | ), |
| 280 | 'admin_label' => true, |
| 281 | 'dependency' => '', |
| 282 | 'weight' => '', |
| 283 | 'group' => '' , |
| 284 | 'edit_field_class' => '' |
| 285 | ), |
| 286 | |
| 287 | array( |
| 288 | 'heading' => __('Insert post title','auxin-elements' ), |
| 289 | 'description' => '', |
| 290 | 'param_name' => 'show_title', |
| 291 | 'type' => 'aux_switch', |
| 292 | 'value' => '1', |
| 293 | 'class' => '', |
| 294 | 'admin_label' => true, |
| 295 | 'dependency' => '', |
| 296 | 'weight' => '', |
| 297 | 'group' => '' , |
| 298 | 'edit_field_class' => '' |
| 299 | ), |
| 300 | |
| 301 | array( |
| 302 | 'heading' => __('Insert post meta','auxin-elements' ), |
| 303 | 'description' => '', |
| 304 | 'param_name' => 'show_info', |
| 305 | 'type' => 'aux_switch', |
| 306 | 'value' => '1', |
| 307 | 'class' => '', |
| 308 | 'admin_label' => true, |
| 309 | 'weight' => '', |
| 310 | 'group' => '' , |
| 311 | 'edit_field_class' => '' |
| 312 | ), |
| 313 | |
| 314 | array( |
| 315 | 'heading' => __('Display Like Button','auxin-elements' ), |
| 316 | '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>'), |
| 317 | 'param_name' => 'display_like', |
| 318 | 'type' => 'aux_switch', |
| 319 | 'value' => '1', |
| 320 | 'holder' => 'dropdown', |
| 321 | 'class' => 'display_like', |
| 322 | 'admin_label' => 1, |
| 323 | 'dependency' => '', |
| 324 | 'weight' => '', |
| 325 | 'group' => '' , |
| 326 | 'edit_field_class' => '' |
| 327 | ), |
| 328 | |
| 329 | array( |
| 330 | 'heading' => __('Display Excerpt','auxin-elements' ), |
| 331 | 'description' => __('Enable it to display post summary instead of full content.','auxin-elements' ), |
| 332 | 'param_name' => 'show_excerpt', |
| 333 | 'type' => 'aux_switch', |
| 334 | 'def_value' => '', |
| 335 | 'value' => '1', |
| 336 | 'holder' => 'dropdown', |
| 337 | 'class' => 'show_excerpt', |
| 338 | 'admin_label' => 1, |
| 339 | 'dependency' => '', |
| 340 | 'weight' => '', |
| 341 | 'group' => '' , |
| 342 | 'edit_field_class' => '' |
| 343 | ), |
| 344 | |
| 345 | array( |
| 346 | 'heading' => __('Content Layout', 'auxin-elements'), |
| 347 | 'description' => __('Specifies the style of content for each post column.', 'auxin-elements' ), |
| 348 | 'param_name' => 'content_layout', |
| 349 | 'type' => 'dropdown', |
| 350 | 'def_value' => 'default', |
| 351 | 'holder' => 'dropdown', |
| 352 | 'class' => 'content_layout', |
| 353 | 'value' =>array ( |
| 354 | 'default' => __('Full Content', 'auxin-elements'), |
| 355 | 'entry-boxed' => __('Boxed Content', 'auxin-elements') |
| 356 | ), |
| 357 | 'admin_label' => true, |
| 358 | 'dependency' => '', |
| 359 | 'weight' => '', |
| 360 | 'group' => '' , |
| 361 | 'edit_field_class' => '' |
| 362 | ), |
| 363 | |
| 364 | array( |
| 365 | 'heading' => __('Excerpt Length','auxin-elements' ), |
| 366 | 'description' => __('Specify summary content in character.','auxin-elements' ), |
| 367 | 'param_name' => 'excerpt_len', |
| 368 | 'type' => 'textfield', |
| 369 | 'value' => '160', |
| 370 | 'holder' => 'textfield', |
| 371 | 'class' => 'excerpt_len', |
| 372 | 'admin_label' => 1, |
| 373 | 'dependency' => array( |
| 374 | 'element' => 'show_excerpt', |
| 375 | 'value' => '1' |
| 376 | ), |
| 377 | 'weight' => '', |
| 378 | 'group' => '' , |
| 379 | 'edit_field_class' => '' |
| 380 | ), |
| 381 | |
| 382 | array( |
| 383 | 'heading' => __('Insert read more button','auxin-elements' ), |
| 384 | 'description' => '', |
| 385 | 'param_name' => 'show_readmore', |
| 386 | 'type' => 'aux_switch', |
| 387 | 'value' => '1', |
| 388 | 'class' => '', |
| 389 | 'admin_label' => true, |
| 390 | 'weight' => '', |
| 391 | 'group' => '' , |
| 392 | 'edit_field_class' => '' |
| 393 | ), |
| 394 | |
| 395 | array( |
| 396 | 'heading' => __('Insert author name in bottom side','auxin-elements' ), |
| 397 | 'description' => '', |
| 398 | 'param_name' => 'show_author_footer', |
| 399 | 'type' => 'aux_switch', |
| 400 | 'value' => '1', |
| 401 | 'class' => '', |
| 402 | 'dependency' => array( |
| 403 | 'element' => 'show_readmore', |
| 404 | 'value' => '0' |
| 405 | ), |
| 406 | 'admin_label' => false, |
| 407 | 'weight' => '', |
| 408 | 'group' => '' , |
| 409 | 'edit_field_class' => '' |
| 410 | ), |
| 411 | |
| 412 | array( |
| 413 | 'heading' => __('Number of columns', 'auxin-elements'), |
| 414 | 'description' => '', |
| 415 | 'param_name' => 'desktop_cnum', |
| 416 | 'type' => 'dropdown', |
| 417 | 'def_value' => '4', |
| 418 | 'holder' => 'dropdown', |
| 419 | 'class' => 'num', |
| 420 | 'value' => array( |
| 421 | '1' => '1' , '2' => '2' , '3' => '3' , |
| 422 | '4' => '4' , '5' => '5' , '6' => '6' |
| 423 | ), |
| 424 | 'admin_label' => true, |
| 425 | 'dependency' => '', |
| 426 | 'weight' => '', |
| 427 | 'group' => 'Layout' , |
| 428 | 'edit_field_class' => '' |
| 429 | ), |
| 430 | |
| 431 | array( |
| 432 | 'heading' => __('Number of columns in tablet size', 'auxin-elements'), |
| 433 | 'description' => '', |
| 434 | 'param_name' => 'tablet_cnum', |
| 435 | 'type' => 'dropdown', |
| 436 | 'def_value' => 'inherit', |
| 437 | 'holder' => 'dropdown', |
| 438 | 'class' => 'num', |
| 439 | 'value' => array( |
| 440 | 'inherit' => 'Inherited from larger', |
| 441 | '1' => '1' , '2' => '2' , '3' => '3' , |
| 442 | '4' => '4' |
| 443 | ), |
| 444 | 'admin_label' => true, |
| 445 | 'dependency' => '', |
| 446 | 'weight' => '', |
| 447 | 'group' => 'Layout' , |
| 448 | 'edit_field_class' => '' |
| 449 | ), |
| 450 | |
| 451 | array( |
| 452 | 'heading' => __('Number of columns in phone size', 'auxin-elements'), |
| 453 | 'description' => '', |
| 454 | 'param_name' => 'phone_cnum', |
| 455 | 'type' => 'dropdown', |
| 456 | 'def_value' => 'inherit', |
| 457 | 'holder' => 'dropdown', |
| 458 | 'class' => 'num', |
| 459 | 'value' => array( |
| 460 | 'inherit' => 'Inherited from larger', |
| 461 | '1' => '1' , '2' => '2' |
| 462 | ), |
| 463 | 'admin_label' => true, |
| 464 | 'dependency' => '', |
| 465 | 'weight' => '', |
| 466 | 'group' => 'Layout' , |
| 467 | 'edit_field_class' => '' |
| 468 | ), |
| 469 | |
| 470 | array( |
| 471 | 'param_name' => 'preview_mode', |
| 472 | 'type' => 'dropdown', |
| 473 | 'def_value' => 'grid', |
| 474 | 'holder' => 'dropdown', |
| 475 | 'class' => 'num', |
| 476 | 'heading' => __('Display items in', 'auxin-elements'), |
| 477 | 'description' => '', |
| 478 | 'value' => array( |
| 479 | 'grid' => 'Grid', |
| 480 | 'carousel' => 'Carousel' |
| 481 | ), |
| 482 | 'admin_label' => true, |
| 483 | 'dependency' => '', |
| 484 | 'weight' => '', |
| 485 | 'group' => '' , |
| 486 | 'edit_field_class' => '' |
| 487 | ), |
| 488 | |
| 489 | // Carousel Options |
| 490 | array( |
| 491 | 'param_name' => 'carousel_space', |
| 492 | 'type' => 'textfield', |
| 493 | 'value' => '30', |
| 494 | 'holder' => 'textfield', |
| 495 | 'class' => 'excerpt_len', |
| 496 | 'heading' => __('Column space','auxin-elements' ), |
| 497 | 'description' => __('Specifies space between carousel columns in pixels', 'auxin-elements' ), |
| 498 | 'admin_label' => 1, |
| 499 | 'dependency' => array( |
| 500 | 'element' => 'preview_mode', |
| 501 | 'value' => 'carousel' |
| 502 | ), |
| 503 | 'weight' => '', |
| 504 | 'group' => '' , |
| 505 | 'edit_field_class' => '' |
| 506 | ), |
| 507 | |
| 508 | array( |
| 509 | 'param_name' => 'carousel_navigation', |
| 510 | 'type' => 'dropdown', |
| 511 | 'def_value' => 'peritem', |
| 512 | 'holder' => 'dropdown', |
| 513 | 'class' => 'num', |
| 514 | 'heading' => __('Navigation type', 'auxin-elements'), |
| 515 | 'description' => '', |
| 516 | 'value' => array( |
| 517 | 'peritem' => __('Move per column', 'auxin-elements'), |
| 518 | 'perpage' => __('Move per page', 'auxin-elements'), |
| 519 | 'scroll' => __('Smooth scroll', 'auxin-elements'), |
| 520 | ), |
| 521 | 'admin_label' => true, |
| 522 | 'dependency' => array( |
| 523 | 'element' => 'preview_mode', |
| 524 | 'value' => 'carousel' |
| 525 | ), |
| 526 | 'weight' => '', |
| 527 | 'group' => '' , |
| 528 | 'edit_field_class' => '' |
| 529 | ), |
| 530 | |
| 531 | array( |
| 532 | 'param_name' => 'carousel_navigation_control', |
| 533 | 'type' => 'dropdown', |
| 534 | 'def_value' => 'arrows', |
| 535 | 'holder' => 'dropdown', |
| 536 | 'class' => 'num', |
| 537 | 'heading' => __('Navigation control', 'auxin-elements'), |
| 538 | 'description' => '', |
| 539 | 'value' => array( |
| 540 | 'arrows' => __('Arrows', 'auxin-elements'), |
| 541 | 'bullets' => __('Bullets', 'auxin-elements'), |
| 542 | '' => __('None', 'auxin-elements'), |
| 543 | ), |
| 544 | 'dependency' => array( |
| 545 | 'element' => 'preview_mode', |
| 546 | 'value' => 'carousel' |
| 547 | ), |
| 548 | 'weight' => '', |
| 549 | 'group' => '' , |
| 550 | 'edit_field_class' => '' |
| 551 | ), |
| 552 | |
| 553 | array( |
| 554 | 'param_name' => 'carousel_loop', |
| 555 | 'type' => 'aux_switch', |
| 556 | 'value' => '1', |
| 557 | 'class' => '', |
| 558 | 'heading' => __('Loop navigation','auxin-elements' ), |
| 559 | 'description' => '', |
| 560 | 'dependency' => array( |
| 561 | 'element' => 'preview_mode', |
| 562 | 'value' => 'carousel' |
| 563 | ), |
| 564 | 'weight' => '', |
| 565 | 'group' => '' , |
| 566 | 'edit_field_class' => '' |
| 567 | ), |
| 568 | |
| 569 | array( |
| 570 | 'param_name' => 'carousel_autoplay', |
| 571 | 'type' => 'aux_switch', |
| 572 | 'value' => '0', |
| 573 | 'class' => '', |
| 574 | 'heading' => __('Autoplay carousel','auxin-elements' ), |
| 575 | 'description' => '', |
| 576 | 'admin_label' => true, |
| 577 | 'dependency' => array( |
| 578 | 'element' => 'preview_mode', |
| 579 | 'value' => 'carousel' |
| 580 | ), |
| 581 | 'weight' => '', |
| 582 | 'group' => '' , |
| 583 | 'edit_field_class' => '' |
| 584 | ), |
| 585 | |
| 586 | array( |
| 587 | 'param_name' => 'carousel_autoplay_delay', |
| 588 | 'type' => 'textfield', |
| 589 | 'value' => '2', |
| 590 | 'holder' => 'textfield', |
| 591 | 'class' => 'excerpt_len', |
| 592 | 'heading' => __('Autoplay delay','auxin-elements' ), |
| 593 | 'description' => __('Specifies the delay between auto-forwarding in seconds', 'auxin-elements' ), |
| 594 | 'admin_label' => 1, |
| 595 | 'dependency' => array( |
| 596 | array( |
| 597 | 'element' => 'preview_mode', |
| 598 | 'value' => 'carousel' |
| 599 | ), |
| 600 | array( |
| 601 | 'element' => 'carousel_autoplay', |
| 602 | 'value' => 1 |
| 603 | ) |
| 604 | ), |
| 605 | 'weight' => '', |
| 606 | 'group' => '' , |
| 607 | 'edit_field_class' => '' |
| 608 | ), |
| 609 | |
| 610 | |
| 611 | array( |
| 612 | 'heading' => __('Extra class name','auxin-elements' ), |
| 613 | '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' ), |
| 614 | 'param_name' => 'extra_classes', |
| 615 | 'type' => 'textfield', |
| 616 | 'value' => '', |
| 617 | 'def_value' => '', |
| 618 | 'holder' => 'textfield', |
| 619 | 'class' => 'extra_classes', |
| 620 | 'admin_label' => true, |
| 621 | 'dependency' => '', |
| 622 | 'weight' => '', |
| 623 | 'group' => '', |
| 624 | 'edit_field_class' => '' |
| 625 | ) |
| 626 | ) |
| 627 | ); |
| 628 | |
| 629 | return $master_array; |
| 630 | } |
| 631 | |
| 632 | add_filter( 'auxin_master_array_shortcodes', 'auxin_get_recent_posts_master_array', 10, 1 ); |
| 633 | |
| 634 | |
| 635 | |
| 636 | |
| 637 | /** |
| 638 | * Element without loop and column |
| 639 | * The front-end output of this element is returned by the following function |
| 640 | * |
| 641 | * @param array $atts The array containing the parsed values from shortcode, it should be same as defined params above. |
| 642 | * @param string $shortcode_content The shorcode content |
| 643 | * @return string The output of element markup |
| 644 | */ |
| 645 | function auxin_widget_recent_posts_callback( $atts, $shortcode_content = null ){ |
| 646 | |
| 647 | global $aux_content_width; |
| 648 | |
| 649 | // Defining default attributes |
| 650 | $default_atts = array( |
| 651 | 'title' => '', // header title |
| 652 | 'cat' => '', |
| 653 | 'num' => '4', // max generated entry |
| 654 | 'exclude' => '', |
| 655 | 'include' => '', |
| 656 | 'posts_per_page' => -1, |
| 657 | 'offset' => '', |
| 658 | 'paged' => '', |
| 659 | 'order_by' => 'menu_order date', |
| 660 | 'order' => 'desc', |
| 661 | 'exclude_without_media' => 0, |
| 662 | 'exclude_custom_post_formats' => 0, |
| 663 | 'exclude_qoute_link' => 0, |
| 664 | 'show_media' => true, |
| 665 | 'display_like' => true, |
| 666 | 'show_excerpt' => true, |
| 667 | 'content_layout' => '', // entry-boxed |
| 668 | 'excerpt_len' => '160', |
| 669 | 'show_title' => true, |
| 670 | 'show_info' => true, |
| 671 | 'show_readmore' => true, |
| 672 | 'show_author_footer' => false, |
| 673 | 'image_aspect_ratio' => 0.75, |
| 674 | 'desktop_cnum' => 4, |
| 675 | 'tablet_cnum' => 'inherit', |
| 676 | 'phone_cnum' => 'inherit', |
| 677 | 'preview_mode' => 'grid', |
| 678 | 'tag' => '', |
| 679 | 'extra_classes' => '', |
| 680 | 'custom_el_id' => '', |
| 681 | 'carousel_space' => '30', |
| 682 | 'carousel_autoplay' => false, |
| 683 | 'carousel_autoplay_delay' => '2', |
| 684 | 'carousel_navigation' => 'peritem', |
| 685 | 'carousel_navigation_control' => 'arrows', |
| 686 | 'carousel_loop' => 1, |
| 687 | 'reset_query' => true, |
| 688 | 'use_wp_query' => false, // true to use the global wp_query, false to use internal custom query |
| 689 | 'base_class' => 'aux-widget-recent-posts' |
| 690 | ); |
| 691 | |
| 692 | $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content ); |
| 693 | extract( $result['parsed_atts'] ); |
| 694 | |
| 695 | ob_start(); |
| 696 | |
| 697 | global $wp_query; |
| 698 | |
| 699 | if( ! $use_wp_query ){ |
| 700 | |
| 701 | // create wp_query to get latest items ----------- |
| 702 | $args = array( |
| 703 | 'post_type' => 'post', |
| 704 | 'orderby' => $order_by, |
| 705 | 'order' => $order, |
| 706 | 'offset' => $offset, |
| 707 | 'paged' => $paged, |
| 708 | 'cat' => $cat, |
| 709 | 'post__not_in' => array_filter( explode( ',', $exclude ) ), |
| 710 | 'post__in' => array_filter( explode( ',', $include ) ), |
| 711 | 'post_status' => 'publish', |
| 712 | 'posts_per_page' => $posts_per_page, |
| 713 | 'ignore_sticky_posts' => 1 |
| 714 | ); |
| 715 | |
| 716 | $wp_query = new WP_Query( $args ); |
| 717 | } |
| 718 | |
| 719 | // widget header ------------------------------ |
| 720 | echo $result['widget_header']; |
| 721 | echo $result['widget_title']; |
| 722 | |
| 723 | |
| 724 | $phone_break_point = 767; |
| 725 | $tablet_break_point = 992; |
| 726 | |
| 727 | $show_comments = true; // shows comments icon |
| 728 | $post_counter = 0; |
| 729 | $column_class = ''; |
| 730 | $item_class = 'aux-col'; |
| 731 | $carousel_attrs = ''; |
| 732 | |
| 733 | if ( 'grid' == $preview_mode ) { |
| 734 | // generate columns class |
| 735 | $column_class = 'aux-match-height aux-row aux-de-col' . $desktop_cnum; |
| 736 | $column_class .= 'inherit' != $tablet_cnum ? ' aux-tb-col'.$tablet_cnum : ''; |
| 737 | $column_class .= 'inherit' != $phone_cnum ? ' aux-mb-col'.$phone_cnum : ''; |
| 738 | $column_class .= 'entry-boxed' == $content_layout ? ' aux-entry-boxed' : ''; |
| 739 | |
| 740 | } elseif ( 'carousel' == $preview_mode ) { |
| 741 | $column_class = 'master-carousel aux-no-js aux-mc-before-init'; |
| 742 | $item_class = 'aux-mc-item'; |
| 743 | |
| 744 | // genereate the master carousel attributes |
| 745 | $carousel_attrs = 'data-columns="' . $desktop_cnum . '"'; |
| 746 | $carousel_attrs .= ' data-autoplay="' . $carousel_autoplay . '"'; |
| 747 | $carousel_attrs .= ' data-delay="' . $carousel_autoplay_delay . '"'; |
| 748 | $carousel_attrs .= ' data-navigation="' . $carousel_navigation . '"'; |
| 749 | $carousel_attrs .= ' data-space="' . $carousel_space. '"'; |
| 750 | $carousel_attrs .= ' data-loop="' . $carousel_loop . '"'; |
| 751 | $carousel_attrs .= ' data-wrap-controls="true"'; |
| 752 | $carousel_attrs .= ' data-bullets="' . ('bullets' == $carousel_navigation_control ? 'true' : 'false') . '"'; |
| 753 | $carousel_attrs .= ' data-bullet-class="aux-bullets aux-small aux-mask"'; |
| 754 | $carousel_attrs .= ' data-arrows="' . ('arrows' == $carousel_navigation_control ? 'true' : 'false') . '"'; |
| 755 | $carousel_attrs .= ' data-match-height="true"'; |
| 756 | |
| 757 | if ( 'inherit' != $tablet_cnum || 'inherit' != $phone_cnum ) { |
| 758 | $carousel_attrs .= ' data-responsive="'. ( 'inherit' != $tablet_cnum ? $tablet_break_point . ':' . $tablet_cnum . ',' : '' ). |
| 759 | ( 'inherit' != $phone_cnum ? $phone_break_point . ':' . $phone_cnum : '' ) . '"'; |
| 760 | } |
| 761 | |
| 762 | } |
| 763 | |
| 764 | $column_media_width = auxin_get_content_column_width( $desktop_cnum, 15 ); |
| 765 | |
| 766 | $have_posts = $wp_query->have_posts(); |
| 767 | |
| 768 | if( $have_posts ){ |
| 769 | ?><div class="<?php echo $column_class ?>" <?php echo $carousel_attrs ?>> <?php |
| 770 | while ( $wp_query->have_posts() ) { |
| 771 | |
| 772 | // break the loop if it is reached to the limit |
| 773 | if ( $post_counter < $num ) { |
| 774 | $post_counter ++; |
| 775 | } else { |
| 776 | break; |
| 777 | } |
| 778 | |
| 779 | $wp_query->the_post(); |
| 780 | $post = $wp_query->post; |
| 781 | |
| 782 | $post_vars = auxin_get_post_format_media( |
| 783 | $post, |
| 784 | array( |
| 785 | 'request_from' => 'archive', |
| 786 | 'media_width' => $phone_break_point, |
| 787 | 'media_size' => 'large',//array( 'width' => $column_media_width, 'height' => $column_media_width * $image_aspect_ratio ), |
| 788 | 'upscale_image' => true, |
| 789 | 'image_from_content' => ! $exclude_without_media, // whether to try to get image from content or not |
| 790 | 'no_gallery' => 'carousel' == $preview_mode, |
| 791 | 'add_image_hw' => false, // whether add width and height attr or not |
| 792 | 'image_sizes' => array( |
| 793 | array( 'min' => '', 'max' => '767px', 'width' => '80vw' ), |
| 794 | array( 'min' => '768px', 'max' => '992px', 'width' => '40vw' ), |
| 795 | array( 'min' => '' , 'max' => '', 'width' => $column_media_width.'px' ) |
| 796 | ), |
| 797 | 'srcset_sizes' => array( |
| 798 | array( 'width' => $column_media_width, 'height' => $column_media_width * $image_aspect_ratio ), |
| 799 | array( 'width' => 2 * $column_media_width, 'height' => 2 * $column_media_width * $image_aspect_ratio ), |
| 800 | array( 'width' => 4 * $column_media_width, 'height' => 4 * $column_media_width * $image_aspect_ratio ) |
| 801 | ) |
| 802 | ) |
| 803 | ); |
| 804 | |
| 805 | extract( $post_vars ); |
| 806 | |
| 807 | $the_format = get_post_format( $post ); |
| 808 | |
| 809 | if( |
| 810 | ( $exclude_custom_post_formats && !empty( $the_format ) ) || |
| 811 | ( $exclude_qoute_link && ( 'link' == $the_format || 'quote' == $the_format ) ) || |
| 812 | ( $exclude_without_media && ! $has_attach ) |
| 813 | ){ |
| 814 | $post_counter --; |
| 815 | continue; |
| 816 | } |
| 817 | |
| 818 | ?> |
| 819 | <div class="<?php echo $item_class ?>"> |
| 820 | <?php include( locate_template( 'templates/theme-parts/entry/post-column.php' ) ); ?> |
| 821 | </div> |
| 822 | <?php |
| 823 | } |
| 824 | |
| 825 | if ( 'carousel' == $preview_mode && 'arrows' == $carousel_navigation_control ) { |
| 826 | ?> |
| 827 | <div class="aux-carousel-controls"> |
| 828 | <div class="aux-next-arrow aux-arrow-nav aux-outline aux-hover-fill"> |
| 829 | <span class="aux-svg-arrow aux-small-right"></span> |
| 830 | <span class="aux-hover-arrow aux-white aux-svg-arrow aux-small-right"></span> |
| 831 | </div> |
| 832 | <div class="aux-prev-arrow aux-arrow-nav aux-outline aux-hover-fill"> |
| 833 | <span class="aux-svg-arrow aux-small-left"></span> |
| 834 | <span class="aux-hover-arrow aux-white aux-svg-arrow aux-small-left"></span> |
| 835 | </div> |
| 836 | </div> |
| 837 | <?php |
| 838 | } |
| 839 | |
| 840 | |
| 841 | ?> </div> <?php |
| 842 | } |
| 843 | |
| 844 | |
| 845 | |
| 846 | if( $reset_query ){ |
| 847 | wp_reset_query(); |
| 848 | } |
| 849 | |
| 850 | // return false if no result found |
| 851 | if( ! $have_posts ){ |
| 852 | ob_get_clean(); |
| 853 | return false; |
| 854 | } |
| 855 | |
| 856 | // widget footer ------------------------------ |
| 857 | echo $result['widget_footer']; |
| 858 | |
| 859 | return ob_get_clean(); |
| 860 | } |
| 861 |