premium-banner.php
7 years ago
premium-blog.php
7 years ago
premium-button.php
7 years ago
premium-carousel.php
7 years ago
premium-contactform.php
7 years ago
premium-countdown.php
7 years ago
premium-counter.php
7 years ago
premium-dual-header.php
7 years ago
premium-fancytext.php
7 years ago
premium-grid.php
7 years ago
premium-image-button.php
7 years ago
premium-imageseparator.php
7 years ago
premium-maps.php
7 years ago
premium-modalbox.php
7 years ago
premium-person.php
7 years ago
premium-pricing-table.php
7 years ago
premium-progressbar.php
7 years ago
premium-testimonials.php
7 years ago
premium-title.php
7 years ago
premium-videobox.php
7 years ago
premium-blog.php
998 lines
| 1 | <?php |
| 2 | namespace Elementor; |
| 3 | |
| 4 | use Elementor\Core\Responsive\Responsive; |
| 5 | |
| 6 | if ( ! defined( 'ABSPATH' ) ) exit; // If this file is called directly, abort. |
| 7 | |
| 8 | class Premium_Blog_Widget extends Widget_Base |
| 9 | { |
| 10 | public function get_name() { |
| 11 | return 'premium-addon-blog'; |
| 12 | } |
| 13 | |
| 14 | public function get_title() { |
| 15 | return \PremiumAddons\Helper_Functions::get_prefix() . ' Blog'; |
| 16 | } |
| 17 | |
| 18 | public function is_reload_preview_required(){ |
| 19 | return true; |
| 20 | } |
| 21 | |
| 22 | public function get_script_depends(){ |
| 23 | return [ |
| 24 | 'isotope-js', |
| 25 | 'premium-addons-js' |
| 26 | ]; |
| 27 | } |
| 28 | |
| 29 | public function get_icon() { |
| 30 | return 'pa-blog'; |
| 31 | } |
| 32 | |
| 33 | public function get_categories() { |
| 34 | return [ 'premium-elements' ]; |
| 35 | } |
| 36 | |
| 37 | // Adding the controls fields for the premium blog |
| 38 | // This will controls the animation, colors and background, dimensions etc |
| 39 | protected function _register_controls() { |
| 40 | |
| 41 | /* Start Content Section */ |
| 42 | $this->start_controls_section('premium_blog_general_settings', |
| 43 | [ |
| 44 | 'label' => esc_html__('Image', 'premium-addons-for-elementor'), |
| 45 | ] |
| 46 | ); |
| 47 | |
| 48 | /*Hover Image Effect*/ |
| 49 | $this->add_control('premium_blog_hover_image_effect', |
| 50 | [ |
| 51 | 'label' => esc_html__('Hover Effect', 'premium-addons-for-elementor'), |
| 52 | 'type' => Controls_Manager::SELECT, |
| 53 | 'description' => esc_html__('Choose a hover effect for the image','premium-addons-for-elementor'), |
| 54 | 'options' => [ |
| 55 | 'none' => esc_html__('None', 'premium-addons-for-elementor'), |
| 56 | 'zoomin' => esc_html__('Zoom In', 'premium-addons-for-elementor'), |
| 57 | 'zoomout'=> esc_html__('Zoom Out', 'premium-addons-for-elementor'), |
| 58 | 'scale' => esc_html__('Scale', 'premium-addons-for-elementor'), |
| 59 | 'gray' => esc_html__('Grayscale', 'premium-addons-for-elementor'), |
| 60 | 'blur' => esc_html__('Blur', 'premium-addons-for-elementor'), |
| 61 | 'bright' => esc_html__('Bright', 'premium-addons-for-elementor'), |
| 62 | 'sepia' => esc_html__('Sepia', 'premium-addons-for-elementor'), |
| 63 | 'trans' => esc_html__('Translate', 'premium-addons-for-elementor'), |
| 64 | ], |
| 65 | 'default' => 'zoomin', |
| 66 | 'label_block' => true |
| 67 | ] |
| 68 | ); |
| 69 | |
| 70 | /*Hover Image Effect*/ |
| 71 | $this->add_control('premium_blog_hover_color_effect', |
| 72 | [ |
| 73 | 'label' => esc_html__('Color Effect', 'premium-addons-for-elementor'), |
| 74 | 'type' => Controls_Manager::SELECT, |
| 75 | 'description' => esc_html__('Choose an overlay color effect','premium-addons-for-elementor'), |
| 76 | 'options' => [ |
| 77 | 'none' => esc_html__('None', 'premium-addons-for-elementor'), |
| 78 | 'framed' => esc_html__('Framed', 'premium-addons-for-elementor'), |
| 79 | 'diagonal' => esc_html__('Diagonal', 'premium-addons-for-elementor'), |
| 80 | 'bordered' => esc_html__('Bordered', 'premium-addons-for-elementor'), |
| 81 | 'squares' => esc_html__('Squares', 'premium-addons-for-elementor'), |
| 82 | ], |
| 83 | 'default' => 'framed', |
| 84 | 'label_block' => true |
| 85 | ] |
| 86 | ); |
| 87 | |
| 88 | /*End Premium Blog*/ |
| 89 | $this->end_controls_section(); |
| 90 | |
| 91 | /*Start Content Settings Section*/ |
| 92 | $this->start_controls_section('premium_blog_content_settings', |
| 93 | [ |
| 94 | 'label' => esc_html__('Content', 'premium-addons-for-elementor'), |
| 95 | ] |
| 96 | ); |
| 97 | |
| 98 | /*Categories Filter*/ |
| 99 | $this->add_control('premium_blog_categories', |
| 100 | [ |
| 101 | 'label' => esc_html__( 'Categories', 'essential-addons-elementor' ), |
| 102 | 'type' => Controls_Manager::SELECT2, |
| 103 | 'description' => esc_html__('Select the categories you want to show','premium-addons-for-elementor'), |
| 104 | 'label_block' => true, |
| 105 | 'multiple' => true, |
| 106 | 'options' => premium_addons_post_type_categories(), |
| 107 | ] |
| 108 | ); |
| 109 | |
| 110 | $this->add_control('premium_blog_title_tag', |
| 111 | [ |
| 112 | 'label' => esc_html__( 'Title HTML Tag', 'premium-addons-for-elementor' ), |
| 113 | 'description' => esc_html__( 'Select a heading tag for the post title.', 'premium-addons-for-elementor' ), |
| 114 | 'type' => Controls_Manager::SELECT, |
| 115 | 'default' => 'h2', |
| 116 | 'options' => [ |
| 117 | 'h1' => 'H1', |
| 118 | 'h2' => 'H2', |
| 119 | 'h3' => 'H3', |
| 120 | 'h4' => 'H4', |
| 121 | 'h5' => 'H5', |
| 122 | 'h6' => 'H6', |
| 123 | ], |
| 124 | 'label_block' => true, |
| 125 | ] |
| 126 | ); |
| 127 | |
| 128 | /*Grid*/ |
| 129 | $this->add_control('premium_blog_grid', |
| 130 | [ |
| 131 | 'label' => esc_html__('Grid', 'premium-addons-for-elementor'), |
| 132 | 'type' => Controls_Manager::SWITCHER, |
| 133 | ] |
| 134 | ); |
| 135 | |
| 136 | /*Masonry*/ |
| 137 | $this->add_control('premium_blog_masonry', |
| 138 | [ |
| 139 | 'label' => esc_html__('Masonry', 'premium-addons-for-elementor'), |
| 140 | 'type' => Controls_Manager::SWITCHER, |
| 141 | 'return_value' => 'true', |
| 142 | 'condition' => [ |
| 143 | 'premium_blog_grid' => 'yes' |
| 144 | ] |
| 145 | ] |
| 146 | ); |
| 147 | |
| 148 | /*Grid Number of Columns*/ |
| 149 | $this->add_control('premium_blog_columns_number', |
| 150 | [ |
| 151 | 'label' => esc_html__('Number of Columns', 'premium-addons-for-elementor'), |
| 152 | 'type' => Controls_Manager::SELECT, |
| 153 | 'options' => [ |
| 154 | '50%' => esc_html__('2 Columns', 'premium-addons-for-elementor'), |
| 155 | '33.33%'=> esc_html__('3 Columns', 'premium-addons-for-elementor'), |
| 156 | '25%' => esc_html__('4 Columns', 'premium-addons-for-elementor'), |
| 157 | ], |
| 158 | 'default' => '50%', |
| 159 | 'selectors' => [ |
| 160 | '{{WRAPPER}} .premium-blog-post-container' => 'width: {{VALUE}}; float:left;' |
| 161 | ], |
| 162 | 'condition' => [ |
| 163 | 'premium_blog_grid' => 'yes', |
| 164 | ] |
| 165 | ] |
| 166 | ); |
| 167 | |
| 168 | /*Grid Spacing*/ |
| 169 | $this->add_responsive_control('premium_blog_posts_spacing', |
| 170 | [ |
| 171 | 'label' => esc_html__('Spacing', 'premium-addons-for-elementor'), |
| 172 | 'type' => Controls_Manager::SLIDER, |
| 173 | 'size_units' => ['px', '%', "em"], |
| 174 | 'range' => [ |
| 175 | 'px' => [ |
| 176 | 'min' => 1, |
| 177 | 'max' => 200, |
| 178 | ], |
| 179 | ], |
| 180 | 'condition' => [ |
| 181 | 'premium_blog_grid' => 'yes' |
| 182 | ], |
| 183 | 'selectors' => [ |
| 184 | '{{WRAPPER}} .premium-blog-post-container' => 'padding: {{SIZE}}{{UNIT}};' |
| 185 | ] |
| 186 | ] |
| 187 | ); |
| 188 | |
| 189 | /*Excerpt*/ |
| 190 | $this->add_control('premium_blog_excerpt', |
| 191 | [ |
| 192 | 'label' => esc_html__('Excerpt', 'premium-addons-for-elementor'), |
| 193 | 'type' => Controls_Manager::SWITCHER, |
| 194 | 'description' => esc_html__('Excerpt is used for article summary with a link to the whole entry. The default except length is 55','premium-addons-for-elementor'), |
| 195 | 'default' => 'yes', |
| 196 | ] |
| 197 | ); |
| 198 | |
| 199 | /*Excerpt Length*/ |
| 200 | $this->add_control('premium_blog_excerpt_length', |
| 201 | [ |
| 202 | 'label' => esc_html__('Excerpt Length', 'premium-addons-for-elementor'), |
| 203 | 'type' => Controls_Manager::NUMBER, |
| 204 | 'default' => 55, |
| 205 | 'label_block' => true, |
| 206 | 'condition' => [ |
| 207 | 'premium_blog_excerpt' => 'yes', |
| 208 | ] |
| 209 | ] |
| 210 | ); |
| 211 | |
| 212 | /*Excerpt Type*/ |
| 213 | $this->add_control('premium_blog_excerpt_type', |
| 214 | [ |
| 215 | 'label' => esc_html__('Excerpt Type', 'premium-addons-for-elementor'), |
| 216 | 'type' => Controls_Manager::SELECT, |
| 217 | 'options' => [ |
| 218 | 'dots' => esc_html__('Dots', 'premium-addons-for-elementor'), |
| 219 | 'link' => esc_html__('Link', 'premium-addons-for-elementor'), |
| 220 | ], |
| 221 | 'default' => 'dots', |
| 222 | 'label_block' => true |
| 223 | ] |
| 224 | ); |
| 225 | |
| 226 | /*Excerpt Text*/ |
| 227 | $this->add_control('premium_blog_excerpt_text', |
| 228 | [ |
| 229 | 'label' => esc_html__( 'Link Text', 'premium-addons-for-elementor' ), |
| 230 | 'type' => Controls_Manager::TEXT, |
| 231 | 'default' => esc_html__('continue reading','premium-addons-for-elementor'), |
| 232 | 'condition' => [ |
| 233 | 'premium_blog_excerpt' => 'yes', |
| 234 | 'premium_blog_excerpt_type' => 'link' |
| 235 | ] |
| 236 | ] |
| 237 | ); |
| 238 | |
| 239 | /*Author Meta*/ |
| 240 | $this->add_control('premium_blog_author_meta', |
| 241 | [ |
| 242 | 'label' => esc_html__('Author Meta', 'premium-addons-for-elementor'), |
| 243 | 'type' => Controls_Manager::SWITCHER, |
| 244 | 'default' => 'yes', |
| 245 | ] |
| 246 | ); |
| 247 | |
| 248 | /*Date Meta*/ |
| 249 | $this->add_control('premium_blog_date_meta', |
| 250 | [ |
| 251 | 'label' => esc_html__('Date Meta', 'premium-addons-for-elementor'), |
| 252 | 'type' => Controls_Manager::SWITCHER, |
| 253 | 'default' => 'yes', |
| 254 | ] |
| 255 | ); |
| 256 | |
| 257 | /*Categories Meta*/ |
| 258 | $this->add_control('premium_blog_categories_meta', |
| 259 | [ |
| 260 | 'label' => esc_html__('Categories Meta', 'premium-addons-for-elementor'), |
| 261 | 'type' => Controls_Manager::SWITCHER, |
| 262 | 'description' => esc_html__('Display or hide categories mata','premium-addons-for-elementor'), |
| 263 | 'default' => 'yes', |
| 264 | ] |
| 265 | ); |
| 266 | |
| 267 | /*Comments Meta*/ |
| 268 | $this->add_control('premium_blog_comments_meta', |
| 269 | [ |
| 270 | 'label' => esc_html__('Comments Meta', 'premium-addons-for-elementor'), |
| 271 | 'description' => esc_html__('Display or hide comments mata','premium-addons-for-elementor'), |
| 272 | 'type' => Controls_Manager::SWITCHER, |
| 273 | 'default' => 'yes', |
| 274 | ] |
| 275 | ); |
| 276 | |
| 277 | /*Tags Meta*/ |
| 278 | $this->add_control('premium_blog_tags_meta', |
| 279 | [ |
| 280 | 'label' => esc_html__('Tags Meta', 'premium-addons-for-elementor'), |
| 281 | 'type' => Controls_Manager::SWITCHER, |
| 282 | 'description' => esc_html__('Display or hide post tags','premium-addons-for-elementor'), |
| 283 | 'default' => 'yes', |
| 284 | ] |
| 285 | ); |
| 286 | |
| 287 | /*Post Format Icon*/ |
| 288 | $this->add_control('premium_blog_post_format_icon', |
| 289 | [ |
| 290 | 'label' => esc_html__( 'Post Format Icon', 'essential-addons-elementor' ), |
| 291 | 'type' => Controls_Manager::SWITCHER, |
| 292 | 'default' => 'yes', |
| 293 | ] |
| 294 | ); |
| 295 | |
| 296 | /*Edit Post Meta*/ |
| 297 | $this->add_control('premium_blog_edit_post', |
| 298 | [ |
| 299 | 'label' => esc_html__('Edit Post Icon', 'premium-addons-for-elementor'), |
| 300 | 'type' => Controls_Manager::SWITCHER, |
| 301 | 'description' => esc_html__('Display or hide edit post option','premium-addons-for-elementor'), |
| 302 | 'default' => 'yes', |
| 303 | ] |
| 304 | ); |
| 305 | |
| 306 | /*Pagination*/ |
| 307 | $this->add_control('premium_blog_paging', |
| 308 | [ |
| 309 | 'label' => esc_html__('Pagination', 'premium-addons-for-elementor'), |
| 310 | 'type' => Controls_Manager::SWITCHER, |
| 311 | 'description' => esc_html__('Pagination is the process of dividing the posts into discrete pages','premium-addons-for-elementor'), |
| 312 | ] |
| 313 | ); |
| 314 | |
| 315 | $this->add_control('premium_blog_new_tab', |
| 316 | [ |
| 317 | 'label' => esc_html__('Links in New Tab', 'premium-addons-for-elementor'), |
| 318 | 'type' => Controls_Manager::SWITCHER, |
| 319 | 'description' => esc_html__('Enable links to be opened in a new tab','premium-addons-for-elementor'), |
| 320 | 'default' => 'yes', |
| 321 | ] |
| 322 | ); |
| 323 | |
| 324 | /*Number of Posts*/ |
| 325 | $this->add_control('premium_blog_number_of_posts', |
| 326 | [ |
| 327 | 'label' => esc_html__('Posts Per Page', 'premium-addons-for-elementor'), |
| 328 | 'description' => esc_html__('Choose how many posts do you want to be displayed per page','premium-addons-for-elementor'), |
| 329 | 'type' => Controls_Manager::NUMBER, |
| 330 | 'min' => 1, |
| 331 | 'default' => 1, |
| 332 | ] |
| 333 | ); |
| 334 | |
| 335 | /*Posts Offset*/ |
| 336 | $this->add_control('premium_blog_offset', |
| 337 | [ |
| 338 | 'label' => esc_html__( 'Offset Count', 'premium-addons-for-elementor' ), |
| 339 | 'description' => esc_html__('The index of post to start with','premium-addons-for-elementor'), |
| 340 | 'type' => Controls_Manager::NUMBER, |
| 341 | 'default' => '0', |
| 342 | 'min' => '0', |
| 343 | ] |
| 344 | ); |
| 345 | |
| 346 | /*Front Text Align*/ |
| 347 | $this->add_responsive_control('premium_flip_text_align', |
| 348 | [ |
| 349 | 'label' => esc_html__( 'Alignment', 'premium-addons-for-elementor' ), |
| 350 | 'type' => Controls_Manager::CHOOSE, |
| 351 | 'options' => [ |
| 352 | 'left' => [ |
| 353 | 'title'=> esc_html__( 'Left', 'premium-addons-for-elementor' ), |
| 354 | 'icon' => 'fa fa-align-left', |
| 355 | ], |
| 356 | 'center' => [ |
| 357 | 'title'=> esc_html__( 'Center', 'premium-addons-for-elementor' ), |
| 358 | 'icon' => 'fa fa-align-center', |
| 359 | ], |
| 360 | 'right' => [ |
| 361 | 'title'=> esc_html__( 'Right', 'premium-addons-for-elementor' ), |
| 362 | 'icon' => 'fa fa-align-right', |
| 363 | ], |
| 364 | ], |
| 365 | 'default' => 'left', |
| 366 | 'selectors' => [ |
| 367 | '{{WRAPPER}} .premium-blog-content-wrapper' => 'text-align: {{VALUE}};', |
| 368 | ], |
| 369 | ] |
| 370 | ); |
| 371 | |
| 372 | |
| 373 | /*End Content Section*/ |
| 374 | $this->end_controls_section(); |
| 375 | |
| 376 | /*Start Color Style Section*/ |
| 377 | $this->start_controls_section('premium_blog_image_style_section', |
| 378 | [ |
| 379 | 'label' => esc_html__('Image', 'premium-addons-for-elementor'), |
| 380 | 'tab' => Controls_Manager::TAB_STYLE, |
| 381 | ] |
| 382 | ); |
| 383 | |
| 384 | /*Plus Icon Color*/ |
| 385 | $this->add_control('premium_blog_plus_color', |
| 386 | [ |
| 387 | 'label' => esc_html__('Icon Color', 'premium-addons-for-elementor'), |
| 388 | 'type' => Controls_Manager::COLOR, |
| 389 | 'scheme' => [ |
| 390 | 'type' => Scheme_Color::get_type(), |
| 391 | 'value' => Scheme_Color::COLOR_2, |
| 392 | ], |
| 393 | 'selectors' => [ |
| 394 | '{{WRAPPER}} .premium-blog-thumbnail-container:before, {{WRAPPER}} .premium-blog-thumbnail-container:after' => 'background-color: {{VALUE}};', |
| 395 | ] |
| 396 | ] |
| 397 | ); |
| 398 | |
| 399 | /*Overlay Color*/ |
| 400 | $this->add_control('premium_blog_overlay_color', |
| 401 | [ |
| 402 | 'label' => esc_html__('Overlay Color', 'premium-addons-for-elementor'), |
| 403 | 'type' => Controls_Manager::COLOR, |
| 404 | 'scheme' => [ |
| 405 | 'type' => Scheme_Color::get_type(), |
| 406 | 'value' => Scheme_Color::COLOR_1, |
| 407 | ], |
| 408 | 'selectors' => [ |
| 409 | '{{WRAPPER}} .premium-blog-framed-effect, {{WRAPPER}} .premium-blog-bordered-effect,{{WRAPPER}} .premium-blog-squares-effect:before,{{WRAPPER}} .premium-blog-squares-effect:after,{{WRAPPER}} .premium-blog-squares-square-container:before,{{WRAPPER}} .premium-blog-squares-square-container:after, {{WRAPPER}} .premium-blog-format-container:hover,{{WRAPPER}} .premium-blog-pagination-container .current' => 'background-color: {{VALUE}};', |
| 410 | ] |
| 411 | ] |
| 412 | ); |
| 413 | |
| 414 | /*Bordered Effect Border Color*/ |
| 415 | $this->add_control('premium_blog_border_effect_color', |
| 416 | [ |
| 417 | 'label' => esc_html__('Border Color', 'premium-addons-for-elementor'), |
| 418 | 'type' => Controls_Manager::COLOR, |
| 419 | 'scheme' => [ |
| 420 | 'type' => Scheme_Color::get_type(), |
| 421 | 'value' => Scheme_Color::COLOR_2, |
| 422 | ], |
| 423 | 'description' => 'Used with Bordered style only', |
| 424 | 'condition' => [ |
| 425 | 'premium_blog_hover_color_effect' => 'bordered', |
| 426 | ], |
| 427 | 'selectors' => [ |
| 428 | '{{WRAPPER}} .premium-blog-bordered-border-container' => 'border-color: {{VALUE}};', |
| 429 | ], |
| 430 | ] |
| 431 | ); |
| 432 | |
| 433 | $this->end_controls_section(); |
| 434 | |
| 435 | $this->start_controls_section('premium_blog_title_style_section', |
| 436 | [ |
| 437 | 'label' => esc_html__('Title', 'premium-addons-for-elementor'), |
| 438 | 'tab' => Controls_Manager::TAB_STYLE, |
| 439 | ] |
| 440 | ); |
| 441 | |
| 442 | /*Titles Color*/ |
| 443 | $this->add_control('premium_blog_title_color', |
| 444 | [ |
| 445 | 'label' => esc_html__('Color', 'premium-addons-for-elementor'), |
| 446 | 'type' => Controls_Manager::COLOR, |
| 447 | 'scheme' => [ |
| 448 | 'type' => Scheme_Color::get_type(), |
| 449 | 'value' => Scheme_Color::COLOR_2, |
| 450 | ], |
| 451 | 'selectors' => [ |
| 452 | '{{WRAPPER}} .premium-blog-entry-title a' => 'color: {{VALUE}};', |
| 453 | ] |
| 454 | ] |
| 455 | ); |
| 456 | |
| 457 | $this->add_group_control( |
| 458 | Group_Control_Typography::get_type(), |
| 459 | [ |
| 460 | 'name' => 'premium_blog_title_typo', |
| 461 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 462 | 'selector' => '{{WRAPPER}} .premium-blog-entry-title', |
| 463 | ] |
| 464 | ); |
| 465 | |
| 466 | /*Titles Hover Color*/ |
| 467 | $this->add_control('premium_blog_title_hover_color', |
| 468 | [ |
| 469 | 'label' => esc_html__('Hover Color', 'premium-addons-for-elementor'), |
| 470 | 'type' => Controls_Manager::COLOR, |
| 471 | 'scheme' => [ |
| 472 | 'type' => Scheme_Color::get_type(), |
| 473 | 'value' => Scheme_Color::COLOR_1, |
| 474 | ], |
| 475 | 'selectors' => [ |
| 476 | '{{WRAPPER}} .premium-blog-entry-title:hover a' => 'color: {{VALUE}};', |
| 477 | ] |
| 478 | ] |
| 479 | ); |
| 480 | |
| 481 | $this->end_controls_section(); |
| 482 | |
| 483 | $this->start_controls_section('premium_blog_meta_style_section', |
| 484 | [ |
| 485 | 'label' => esc_html__('Meta', 'premium-addons-for-elementor'), |
| 486 | 'tab' => Controls_Manager::TAB_STYLE, |
| 487 | ] |
| 488 | ); |
| 489 | |
| 490 | /*Meta Color*/ |
| 491 | $this->add_control('premium_blog_meta_color', |
| 492 | [ |
| 493 | 'label' => esc_html__('Color', 'premium-addons-for-elementor'), |
| 494 | 'type' => Controls_Manager::COLOR, |
| 495 | 'scheme' => [ |
| 496 | 'type' => Scheme_Color::get_type(), |
| 497 | 'value' => Scheme_Color::COLOR_2, |
| 498 | ], |
| 499 | 'selectors' => [ |
| 500 | '{{WRAPPER}} .premium-blog-entry-meta, {{WRAPPER}} .premium-blog-entry-meta a, {{WRAPPER}} .premium-blog-post-content .premium-blog-excerpt-link' => 'color: {{VALUE}};', |
| 501 | ] |
| 502 | ] |
| 503 | ); |
| 504 | |
| 505 | |
| 506 | $this->add_group_control( |
| 507 | Group_Control_Typography::get_type(), |
| 508 | [ |
| 509 | 'name' => 'premium_blog_meta_typo', |
| 510 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 511 | 'selector' => '{{WRAPPER}} .premium-blog-entry-meta a,{{WRAPPER}} .premium-blog-post-content .premium-blog-excerpt-link', |
| 512 | ] |
| 513 | ); |
| 514 | |
| 515 | /*Meta Hover Color*/ |
| 516 | $this->add_control('premium_blog_meta_hover_color', |
| 517 | [ |
| 518 | 'label' => esc_html__('Hover Color', 'premium-addons-for-elementor'), |
| 519 | 'type' => Controls_Manager::COLOR, |
| 520 | 'scheme' => [ |
| 521 | 'type' => Scheme_Color::get_type(), |
| 522 | 'value' => Scheme_Color::COLOR_1, |
| 523 | ], |
| 524 | 'selectors' => [ |
| 525 | '{{WRAPPER}} .premium-blog-entry-meta a:hover, {{WRAPPER}} .premium-blog-post-content .premium-blog-excerpt-link:hover' => 'color: {{VALUE}};', |
| 526 | ] |
| 527 | ] |
| 528 | ); |
| 529 | |
| 530 | $this->end_controls_section(); |
| 531 | |
| 532 | $this->start_controls_section('premium_blog_content_style_section', |
| 533 | [ |
| 534 | 'label' => esc_html__('Content', 'premium-addons-for-elementor'), |
| 535 | 'tab' => Controls_Manager::TAB_STYLE, |
| 536 | ] |
| 537 | ); |
| 538 | |
| 539 | /*Post Content Color*/ |
| 540 | $this->add_control('premium_blog_post_content_color', |
| 541 | [ |
| 542 | 'label' => esc_html__('Color', 'premium-addons-for-elementor'), |
| 543 | 'type' => Controls_Manager::COLOR, |
| 544 | 'scheme' => [ |
| 545 | 'type' => Scheme_Color::get_type(), |
| 546 | 'value' => Scheme_Color::COLOR_3, |
| 547 | ], |
| 548 | 'selectors' => [ |
| 549 | '{{WRAPPER}} .premium-blog-post-content' => 'color: {{VALUE}};', |
| 550 | ] |
| 551 | ] |
| 552 | ); |
| 553 | |
| 554 | /*Post Content Typography*/ |
| 555 | $this->add_group_control( |
| 556 | Group_Control_Typography::get_type(), |
| 557 | [ |
| 558 | 'name' => 'premium_blog_content_typo', |
| 559 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 560 | 'selector' => '{{WRAPPER}} .premium-blog-post-content', |
| 561 | ] |
| 562 | ); |
| 563 | |
| 564 | |
| 565 | /*Content Background Color*/ |
| 566 | $this->add_control('premium_blog_content_background_color', |
| 567 | [ |
| 568 | 'label' => esc_html__('Background Color', 'premium-addons-for-elementor'), |
| 569 | 'type' => Controls_Manager::COLOR, |
| 570 | 'default' => '#f5f5f5', |
| 571 | 'selectors' => [ |
| 572 | '{{WRAPPER}} .premium-blog-content-wrapper' => 'background-color: {{VALUE}};', |
| 573 | ] |
| 574 | ] |
| 575 | ); |
| 576 | |
| 577 | $this->end_controls_section(); |
| 578 | |
| 579 | $this->start_controls_section('premium_blog_tags_style_section', |
| 580 | [ |
| 581 | 'label' => esc_html__('Tags', 'premium-addons-for-elementor'), |
| 582 | 'tab' => Controls_Manager::TAB_STYLE, |
| 583 | ] |
| 584 | ); |
| 585 | |
| 586 | /*Tags Color*/ |
| 587 | $this->add_control('premium_blog_tags_color', |
| 588 | [ |
| 589 | 'label' => esc_html__('Color', 'premium-addons-for-elementor'), |
| 590 | 'type' => Controls_Manager::COLOR, |
| 591 | 'scheme' => [ |
| 592 | 'type' => Scheme_Color::get_type(), |
| 593 | 'value' => Scheme_Color::COLOR_2, |
| 594 | ], |
| 595 | 'selectors' => [ |
| 596 | '{{WRAPPER}} .premium-blog-post-tags-container, {{WRAPPER}} .premium-blog-post-tags-container a' => 'color: {{VALUE}};', |
| 597 | ] |
| 598 | ] |
| 599 | ); |
| 600 | |
| 601 | /*Tags Typography*/ |
| 602 | $this->add_group_control( |
| 603 | Group_Control_Typography::get_type(), |
| 604 | [ |
| 605 | 'name' => 'premium_blog_tags_typo', |
| 606 | 'scheme' => Scheme_Typography::TYPOGRAPHY_1, |
| 607 | 'selector' => '{{WRAPPER}} .premium-blog-post-tags-container a', |
| 608 | ] |
| 609 | ); |
| 610 | |
| 611 | /*Tags Hover Color*/ |
| 612 | $this->add_control('premium_blog_tags_hoer_color', |
| 613 | [ |
| 614 | 'label' => esc_html__('Hover Color', 'premium-addons-for-elementor'), |
| 615 | 'type' => Controls_Manager::COLOR, |
| 616 | 'scheme' => [ |
| 617 | 'type' => Scheme_Color::get_type(), |
| 618 | 'value' => Scheme_Color::COLOR_1, |
| 619 | ], |
| 620 | 'selectors' => [ |
| 621 | '{{WRAPPER}} .premium-blog-post-tags-container a:hover' => 'color: {{VALUE}};', |
| 622 | ] |
| 623 | ] |
| 624 | ); |
| 625 | |
| 626 | $this->end_controls_section(); |
| 627 | |
| 628 | /*Post Format Icon*/ |
| 629 | $this->start_controls_section('premium_blog_format_style_section', |
| 630 | [ |
| 631 | 'label' => esc_html__('Post Format Icon', 'premium-addons-for-elementor'), |
| 632 | 'tab' => Controls_Manager::TAB_STYLE, |
| 633 | 'condition' => [ |
| 634 | 'premium_blog_post_format_icon' => 'yes' |
| 635 | ] |
| 636 | ] |
| 637 | ); |
| 638 | |
| 639 | $this->add_control('premium_blog_format_icon_size', |
| 640 | [ |
| 641 | 'label' => esc_html__('Size', 'premium-addons-for-elementor'), |
| 642 | 'type' => Controls_Manager::SLIDER, |
| 643 | 'description' => esc_html__('Choose icon size in (PX, EM)', 'premium-addons-for-elementor'), |
| 644 | 'range' => [ |
| 645 | 'em' => [ |
| 646 | 'min' => 1, |
| 647 | 'max' => 10, |
| 648 | ], |
| 649 | ], |
| 650 | 'size_units' => ['px', "em"], |
| 651 | 'label_block' => true, |
| 652 | 'selectors' => [ |
| 653 | '{{WRAPPER}} .premium-blog-format-icon' => 'font-size: {{SIZE}}{{UNIT}};', |
| 654 | ] |
| 655 | ] |
| 656 | ); |
| 657 | |
| 658 | /*Post Format Icon Color*/ |
| 659 | $this->add_control('premium_blog_format_icon_color', |
| 660 | [ |
| 661 | 'label' => esc_html__('Color', 'premium-addons-for-elementor'), |
| 662 | 'type' => Controls_Manager::COLOR, |
| 663 | 'scheme' => [ |
| 664 | 'type' => Scheme_Color::get_type(), |
| 665 | 'value' => Scheme_Color::COLOR_2, |
| 666 | ], |
| 667 | 'selectors' => [ |
| 668 | '{{WRAPPER}} .premium-blog-format-container i' => 'color: {{VALUE}};', |
| 669 | ] |
| 670 | ] |
| 671 | ); |
| 672 | |
| 673 | /*Post Format Icon Color*/ |
| 674 | $this->add_control('premium_blog_format_icon_hover_color', |
| 675 | [ |
| 676 | 'label' => esc_html__('Hover Color', 'premium-addons-for-elementor'), |
| 677 | 'type' => Controls_Manager::COLOR, |
| 678 | 'scheme' => [ |
| 679 | 'type' => Scheme_Color::get_type(), |
| 680 | 'value' => Scheme_Color::COLOR_1, |
| 681 | ], |
| 682 | 'selectors' => [ |
| 683 | '{{WRAPPER}} .premium-blog-format-container:hover i' => 'color: {{VALUE}};', |
| 684 | ] |
| 685 | ] |
| 686 | ); |
| 687 | |
| 688 | /*Post Format Background Color*/ |
| 689 | $this->add_control('premium_blog_format_back_color', |
| 690 | [ |
| 691 | 'label' => esc_html__('Background Color', 'premium-addons-for-elementor'), |
| 692 | 'type' => Controls_Manager::COLOR, |
| 693 | 'scheme' => [ |
| 694 | 'type' => Scheme_Color::get_type(), |
| 695 | 'value' => Scheme_Color::COLOR_1, |
| 696 | ], |
| 697 | 'selectors' => [ |
| 698 | '{{WRAPPER}} .premium-blog-format-container' => 'background-color: {{VALUE}};', |
| 699 | ] |
| 700 | ] |
| 701 | ); |
| 702 | |
| 703 | /*Post Format Hover Background Color*/ |
| 704 | $this->add_control('premium_blog_format_back_hover_color', |
| 705 | [ |
| 706 | 'label' => esc_html__('Hover Background Color', 'premium-addons-for-elementor'), |
| 707 | 'type' => Controls_Manager::COLOR, |
| 708 | 'scheme' => [ |
| 709 | 'type' => Scheme_Color::get_type(), |
| 710 | 'value' => Scheme_Color::COLOR_2, |
| 711 | ], |
| 712 | 'selectors' => [ |
| 713 | '{{WRAPPER}} .premium-blog-format-container:hover' => 'background-color: {{VALUE}};', |
| 714 | ] |
| 715 | ] |
| 716 | ); |
| 717 | |
| 718 | /*End Format Icon Style Section*/ |
| 719 | $this->end_controls_section(); |
| 720 | |
| 721 | /*Pagination Style*/ |
| 722 | $this->start_controls_section('premium_blog_pagination_Style', |
| 723 | [ |
| 724 | 'label' => esc_html__('Pagination Style', 'premium-addons-for-elementor'), |
| 725 | 'tab' => Controls_Manager::TAB_STYLE, |
| 726 | 'condition' => [ |
| 727 | 'premium_blog_paging' => 'yes', |
| 728 | ] |
| 729 | ]); |
| 730 | |
| 731 | $this->start_controls_tabs('premium_blog_pagination_colors'); |
| 732 | |
| 733 | $this->start_controls_tab('premium_blog_pagination_nomral', |
| 734 | [ |
| 735 | 'label' => esc_html__('Normal', 'premium-addons-for-elementor'), |
| 736 | |
| 737 | ]); |
| 738 | |
| 739 | $this->add_control('prmeium_blog_pagination_color', |
| 740 | [ |
| 741 | 'label' => esc_html__('Color', 'premium-addons-for-elementor'), |
| 742 | 'type' => Controls_Manager::COLOR, |
| 743 | 'scheme' => [ |
| 744 | 'type' => Scheme_Color::get_type(), |
| 745 | 'value' => Scheme_Color::COLOR_2, |
| 746 | ], |
| 747 | 'selectors' => [ |
| 748 | '{{WRAPPER}} .premium-blog-pagination-container li a, {{WRAPPER}} .premium-blog-pagination-container li span' => 'color: {{VALUE}};' |
| 749 | ] |
| 750 | ]); |
| 751 | |
| 752 | $this->add_control('prmeium_blog_pagination_back_color', |
| 753 | [ |
| 754 | 'label' => esc_html__('Background Color', 'premium-addons-for-elementor'), |
| 755 | 'type' => Controls_Manager::COLOR, |
| 756 | 'scheme' => [ |
| 757 | 'type' => Scheme_Color::get_type(), |
| 758 | 'value' => Scheme_Color::COLOR_1, |
| 759 | ], |
| 760 | 'selectors' => [ |
| 761 | '{{WRAPPER}} .premium-blog-pagination-container li a, {{WRAPPER}} .premium-blog-pagination-container li span' => 'background-color: {{VALUE}};' |
| 762 | ] |
| 763 | ]); |
| 764 | |
| 765 | $this->end_controls_tab(); |
| 766 | |
| 767 | $this->start_controls_tab('premium_blog_pagination_hover', |
| 768 | [ |
| 769 | 'label' => esc_html__('Hover', 'premium-addons-for-elementor'), |
| 770 | |
| 771 | ]); |
| 772 | |
| 773 | $this->add_control('prmeium_blog_pagination_hover_color', |
| 774 | [ |
| 775 | 'label' => esc_html__('Color', 'premium-addons-for-elementor'), |
| 776 | 'type' => Controls_Manager::COLOR, |
| 777 | 'scheme' => [ |
| 778 | 'type' => Scheme_Color::get_type(), |
| 779 | 'value' => Scheme_Color::COLOR_1, |
| 780 | ], |
| 781 | 'selectors' => [ |
| 782 | '{{WRAPPER}} .premium-blog-pagination-container li:hover a, {{WRAPPER}} .premium-blog-pagination-container li:hover span' => 'color: {{VALUE}};' |
| 783 | ] |
| 784 | ]); |
| 785 | |
| 786 | $this->add_control('prmeium_blog_pagination_back_hover_color', |
| 787 | [ |
| 788 | 'label' => esc_html__('Background Color', 'premium-addons-for-elementor'), |
| 789 | 'type' => Controls_Manager::COLOR, |
| 790 | 'scheme' => [ |
| 791 | 'type' => Scheme_Color::get_type(), |
| 792 | 'value' => Scheme_Color::COLOR_2, |
| 793 | ], |
| 794 | 'selectors' => [ |
| 795 | '{{WRAPPER}} .premium-blog-pagination-container li:hover a, {{WRAPPER}} .premium-blog-pagination-container li:hover span' => 'background-color: {{VALUE}};' |
| 796 | ] |
| 797 | ]); |
| 798 | |
| 799 | $this->end_controls_tab(); |
| 800 | |
| 801 | $this->end_controls_tabs(); |
| 802 | |
| 803 | /*End Paging Style Section*/ |
| 804 | $this->end_controls_section(); |
| 805 | |
| 806 | } |
| 807 | |
| 808 | protected function get_blog_responsive_style() { |
| 809 | |
| 810 | $breakpoints = Responsive::get_breakpoints(); |
| 811 | |
| 812 | $style = '<style>'; |
| 813 | $style .= '@media ( max-width: ' . $breakpoints['lg'] . 'px ) {'; |
| 814 | $style .= '.premium-blog-entry-title {'; |
| 815 | $style .= 'line-height: 1;'; |
| 816 | $style .= '}'; |
| 817 | $style .= '.premium-blog-entry-title a {'; |
| 818 | $style .= 'font-size: 18px;'; |
| 819 | $style .= '}'; |
| 820 | $style .= '}'; |
| 821 | $style .= '@media ( max-width: ' . $breakpoints['md'] . 'px ) {'; |
| 822 | $style .= '.premium-blog-post-container {'; |
| 823 | $style .= 'width: 100% !important;'; |
| 824 | $style .= '}'; |
| 825 | $style .= '.premium-blog-content-wrapper {'; |
| 826 | $style .= 'padding: 15px;'; |
| 827 | $style .= '}'; |
| 828 | $style .= '.premium-blog-entry-title {'; |
| 829 | $style .= 'line-height: 1;'; |
| 830 | $style .= '}'; |
| 831 | $style .= '.premium-blog-entry-title a {'; |
| 832 | $style .= 'font-size: 16px;'; |
| 833 | $style .= '}'; |
| 834 | $style .= '}'; |
| 835 | $style .= '</style>'; |
| 836 | |
| 837 | return $style; |
| 838 | |
| 839 | } |
| 840 | |
| 841 | protected function render($instance = []) |
| 842 | { |
| 843 | |
| 844 | if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } else if ( get_query_var('page') ) { $paged = get_query_var('page'); } else { $paged = 1; } |
| 845 | |
| 846 | // get our input from the widget settings. |
| 847 | $settings = $this->get_settings(); |
| 848 | |
| 849 | if($settings['premium_blog_new_tab'] == 'yes'){ |
| 850 | $target = '_blank'; |
| 851 | } else { |
| 852 | $target = '_self'; |
| 853 | } |
| 854 | |
| 855 | $image_effect = $settings['premium_blog_hover_image_effect']; |
| 856 | |
| 857 | $post_effect = $settings['premium_blog_hover_color_effect']; |
| 858 | |
| 859 | $offset = $settings['premium_blog_offset']; |
| 860 | |
| 861 | $post_per_page = $settings['premium_blog_number_of_posts']; |
| 862 | |
| 863 | $new_offset = $offset + ( ( $paged - 1 ) * $post_per_page ); |
| 864 | |
| 865 | $post_args = premium_blog_get_post_settings($settings); |
| 866 | |
| 867 | $posts = premium_blog_get_post_data($post_args, $paged , $new_offset); |
| 868 | |
| 869 | $excerpt_type = $settings['premium_blog_excerpt_type']; |
| 870 | $excerpt_text = $settings['premium_blog_excerpt_text']; |
| 871 | |
| 872 | switch($settings['premium_blog_columns_number']){ |
| 873 | case '50%' : |
| 874 | $col_number = 'col-2'; |
| 875 | break; |
| 876 | case '33.33%' : |
| 877 | $col_number = 'col-3'; |
| 878 | break; |
| 879 | case '25%' : |
| 880 | $col_number = 'col-4'; |
| 881 | break; |
| 882 | } |
| 883 | |
| 884 | |
| 885 | ?> |
| 886 | <div class="premium-blog-wrap <?php echo esc_attr($col_number); ?>" data-pa-masonry="<?php echo esc_attr($settings['premium_blog_masonry']); ?>"> |
| 887 | <?php |
| 888 | if(count($posts)){ |
| 889 | global $post; |
| 890 | ?> |
| 891 | <?php |
| 892 | foreach($posts as $post){ |
| 893 | setup_postdata($post); |
| 894 | ?> |
| 895 | <div class="premium-blog-post-container"> |
| 896 | <div class="premium-blog-thumb-effect-wrapper"> |
| 897 | <div class="premium-blog-thumbnail-container <?php echo 'premium-blog-' . $image_effect . '-effect';?>"> |
| 898 | <a href="<?php the_permalink(); ?>" target="<?php echo esc_attr($target); ?>"><?php the_post_thumbnail('full'); ?></a> |
| 899 | </div> |
| 900 | <div class="premium-blog-effect-container <?php echo 'premium-blog-'. $post_effect . '-effect'; ?>"> |
| 901 | <a class="premium-blog-post-link" href="<?php the_permalink(); ?>" target="<?php echo esc_attr($target); ?>"></a> |
| 902 | <?php if( $settings['premium_blog_hover_color_effect'] === 'bordered' ) : ?> |
| 903 | <div class="premium-blog-bordered-border-container"></div> |
| 904 | <?php elseif( $settings['premium_blog_hover_color_effect'] === 'squares' ) : ?> |
| 905 | <div class="premium-blog-squares-square-container"></div> |
| 906 | <?php endif; ?> |
| 907 | </div> |
| 908 | </div> |
| 909 | <div class="premium-blog-content-wrapper <?php echo (!has_post_thumbnail()) ? 'empty-thumb' : ''; ?>"> |
| 910 | <div class="premium-blog-inner-container"> |
| 911 | <?php if( $settings['premium_blog_post_format_icon'] === 'yes' ) : ?> |
| 912 | <div class="premium-blog-format-container"> |
| 913 | <a class="premium-blog-format-link" href="<?php the_permalink(); ?>" title="<?php if( get_post_format() === ' ') : echo 'standard' ; else : echo get_post_format(); endif; ?>" target="<?php echo esc_attr($target); ?>"><i class="premium-blog-format-icon fa fa-<?php if ( get_post_format() === 'aside' ) : echo 'file-text-o'; ?> |
| 914 | <?php elseif ( get_post_format() === 'audio' ) : echo 'music'; ?> |
| 915 | <?php elseif ( get_post_format() === 'gallery' ) : echo 'file-image-o'; ?> |
| 916 | <?php elseif ( get_post_format() === 'image' ) : echo 'picture-o'; ?> |
| 917 | <?php elseif ( get_post_format() === 'link' ) : echo 'link'; ?> |
| 918 | <?php elseif ( get_post_format() === 'quote' ) :echo 'quote-left'; ?> |
| 919 | <?php elseif ( get_post_format() === 'video' ) : echo 'video-camera'; ?> |
| 920 | <?php else : echo 'thumb-tack'; ?> |
| 921 | <?php endif; ?>"></i></a> |
| 922 | </div> |
| 923 | <?php endif; ?> |
| 924 | <div class="premium-blog-entry-container"> |
| 925 | <<?php echo $settings['premium_blog_title_tag']; ?> class="premium-blog-entry-title"><a href="<?php the_permalink(); ?>" target="<?php echo esc_attr($target); ?>"><?php the_title(); ?></a></<?php echo $settings['premium_blog_title_tag']; ?>> |
| 926 | <div class="premium-blog-entry-meta" style="<?php if( $settings['premium_blog_post_format_icon'] !== 'yes' ) : echo 'margin-left:0px'; endif; ?>"> |
| 927 | <?php if( $settings['premium_blog_author_meta'] === 'yes' ) : ?> |
| 928 | <span class="premium-blog-post-author premium-blog-meta-data"><i class="fa fa-user fa-fw"></i><?php the_author_posts_link();?></span> |
| 929 | <?php endif; ?> |
| 930 | <?php if( $settings['premium_blog_date_meta'] === 'yes' ) : ?> |
| 931 | <span class="premium-blog-post-time premium-blog-meta-data"><i class="fa fa-calendar fa-fw"></i><a href="<?php the_permalink(); ?>" target="<?php echo esc_attr($target); ?>"><?php the_time('F j, Y'); ?></a></span> |
| 932 | <?php endif; ?> |
| 933 | <?php if( $settings['premium_blog_categories_meta'] === 'yes' ) : ?> |
| 934 | <span class="premium-blog-post-categories premium-blog-meta-data"><i class="fa fa-align-left fa-fw"></i><?php the_category(', '); ?></span> |
| 935 | <?php endif; ?> |
| 936 | <?php if( $settings['premium_blog_comments_meta'] === 'yes' ) : ?> |
| 937 | <span class="premium-blog-post-comments premium-blog-meta-data"><i class="fa fa-comments-o fa-fw"></i><a href="<?php the_permalink(); ?>" target="<?php echo esc_attr($target); ?>"><?php comments_number('0 Comments', '1', '%'); ?> </a></span> |
| 938 | <?php endif; ?> |
| 939 | <?php if( $settings['premium_blog_edit_post'] === 'yes' ) : ?> |
| 940 | <span class="premium-blog-post-edit premium-blog-meta-data"><i class="fa fa-pencil fa-fw"></i><?php edit_post_link(); ?></span> |
| 941 | <?php endif; ?> |
| 942 | </div> |
| 943 | </div> |
| 944 | </div> |
| 945 | <div class="premium-blog-post-content" style="<?php if ( $settings['premium_blog_post_format_icon'] !== 'yes' ) : echo 'margin-left:0px;'; endif; ?>"> |
| 946 | <?php |
| 947 | if ( $settings['premium_blog_excerpt'] === 'yes' ) : |
| 948 | echo premium_addons_get_excerpt_by_id(get_the_ID(),$settings['premium_blog_excerpt_length'],$excerpt_type,$excerpt_text); |
| 949 | else: the_content(); |
| 950 | endif; ?> |
| 951 | </div> |
| 952 | <div class="premium-blog-post-tags-container" style="<?php if( $settings['premium_blog_post_format_icon'] !== 'yes' ) : echo 'margin-left:0px;'; endif; ?>"> |
| 953 | <?php if( $settings['premium_blog_tags_meta'] === 'yes' && the_tags() != '' ) : ?> |
| 954 | <span class="premium-blog-post-tags"><i class="fa fa-tags fa-fw"></i><?php the_tags(' ', ', '); ?> </span> |
| 955 | <?php endif; ?> |
| 956 | </div> |
| 957 | </div> |
| 958 | </div> |
| 959 | <?php }?> |
| 960 | <div class="premium-blog-clear-fix"></div> |
| 961 | </div> |
| 962 | <?php if ( $settings['premium_blog_paging'] === 'yes' ) : ?> |
| 963 | <div class="premium-blog-pagination-container"> |
| 964 | <?php |
| 965 | $count_posts = wp_count_posts(); |
| 966 | $published_posts = $count_posts->publish; |
| 967 | |
| 968 | $page_tot = ceil( ( $published_posts - $offset ) / $settings['premium_blog_number_of_posts'] ); |
| 969 | if ( $page_tot > 1 ) { |
| 970 | $big = 999999999; |
| 971 | echo paginate_links( array( |
| 972 | 'base' => str_replace( $big, '%#%',get_pagenum_link( 999999999, false ) ), |
| 973 | 'format' => '?paged=%#%', |
| 974 | 'current' => max( 1, $paged ), |
| 975 | 'total' => $page_tot, |
| 976 | 'prev_next' => true, |
| 977 | 'prev_text' => esc_html__("‹ Previous"), |
| 978 | 'next_text' => esc_html__("Next ›"), |
| 979 | 'end_size' => 1, |
| 980 | 'mid_size' => 2, |
| 981 | 'type' => 'list' |
| 982 | )); |
| 983 | } |
| 984 | ?> |
| 985 | </div> |
| 986 | <?php endif; ?> |
| 987 | <?php |
| 988 | echo $this->get_blog_responsive_style(); |
| 989 | wp_reset_postdata(); |
| 990 | |
| 991 | } ?> |
| 992 | |
| 993 | |
| 994 | |
| 995 | <?php |
| 996 | } |
| 997 | } |
| 998 | Plugin::instance()->widgets_manager->register_widget_type(new Premium_Blog_Widget()); |