From 92f50e15b4674bea242bc2d5d613d9c365565cb2 Mon Sep 17 00:00:00 2001 From: ankitkarki17 Date: Fri, 16 Oct 2020 13:17:56 +0545 Subject: [PATCH 01/11] Make WPML/Polylang plugin compatible with Accelerate theme --- wpml-config.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 wpml-config.xml diff --git a/wpml-config.xml b/wpml-config.xml new file mode 100644 index 0000000..e97a833 --- /dev/null +++ b/wpml-config.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + From 050937ac619aa702477107feb45463f842684fe5 Mon Sep 17 00:00:00 2001 From: ankitkarki17 Date: Fri, 16 Oct 2020 14:12:58 +0545 Subject: [PATCH 02/11] Update Changelog --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index 290dee2..710ae48 100644 --- a/readme.txt +++ b/readme.txt @@ -46,6 +46,7 @@ If you want to translate this theme to your language, Please visit:- https://tra == Changelog == = Version TBD = +* Enhancement - Make WPML/Polylang plugin compatible. * Tweak - Remove deprecate Custom CSS customize option provided via theme. = Version 1.4.7 - 2020-08-13 = From 8d5443f91111e0db85578cca9fb155a8d38bacbe Mon Sep 17 00:00:00 2001 From: ankitkarki17 Date: Mon, 19 Oct 2020 12:52:56 +0545 Subject: [PATCH 03/11] Remove unnecessary options --- wpml-config.xml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/wpml-config.xml b/wpml-config.xml index e97a833..1a26d64 100644 --- a/wpml-config.xml +++ b/wpml-config.xml @@ -7,9 +7,5 @@ - - - - From 62b98d04e60ce352eda61563f24d788675265d92 Mon Sep 17 00:00:00 2001 From: ankitkarki17 Date: Tue, 20 Oct 2020 09:07:15 +0545 Subject: [PATCH 04/11] Make WPML/Polylang plugin compatible --- wpml-config.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wpml-config.xml b/wpml-config.xml index 1a26d64..bb89c02 100644 --- a/wpml-config.xml +++ b/wpml-config.xml @@ -7,5 +7,10 @@ + + + + + From 53c680cfddd6ff1dec597611bcc592f3d97d7ecb Mon Sep 17 00:00:00 2001 From: ankitkarki17 Date: Tue, 20 Oct 2020 10:29:20 +0545 Subject: [PATCH 05/11] Remove unnecessary options --- wpml-config.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/wpml-config.xml b/wpml-config.xml index bb89c02..1a26d64 100644 --- a/wpml-config.xml +++ b/wpml-config.xml @@ -7,10 +7,5 @@ - - - - - From cf2405d5f0bf5d2ba212151b6eb5e721010d19f4 Mon Sep 17 00:00:00 2001 From: ankitkarki17 Date: Tue, 20 Oct 2020 12:32:21 +0545 Subject: [PATCH 06/11] Add slider options --- wpml-config.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wpml-config.xml b/wpml-config.xml index 1a26d64..d250b43 100644 --- a/wpml-config.xml +++ b/wpml-config.xml @@ -7,5 +7,11 @@ + + + + + + From f0c140864cd350fa419158f28b6b1f7571f91fcc Mon Sep 17 00:00:00 2001 From: ankitkarki17 Date: Tue, 20 Oct 2020 23:09:01 +0545 Subject: [PATCH 07/11] Make compatible --- inc/widgets/accelerate-call-to-action-widget.php | 15 ++++++++++++++- inc/widgets/accelerate-recent-work-widget.php | 15 ++++++++++++++- wpml-config.xml | 6 ------ 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/inc/widgets/accelerate-call-to-action-widget.php b/inc/widgets/accelerate-call-to-action-widget.php index a0193fa..d3d4776 100644 --- a/inc/widgets/accelerate-call-to-action-widget.php +++ b/inc/widgets/accelerate-call-to-action-widget.php @@ -78,6 +78,14 @@ function widget( $args, $instance ) { $button_text = isset( $instance[ 'button_text' ] ) ? $instance[ 'button_text' ] : ''; $button_url = isset( $instance[ 'button_url' ] ) ? $instance[ 'button_url' ] : '#'; + // For WPML plugin compatibility + if ( function_exists( 'icl_register_string' ) ) { + icl_register_string( 'Accelerate', 'TG: Call to Action widget main text' . $this->id, $text_main ); + icl_register_string( 'Accelerate', 'TG: Call to Action widget additional text' . $this->id, $text_additional ); + icl_register_string( 'Accelerate', 'TG: Call to Action widget button text' . $this->id, $button_text ); + icl_register_string( 'Accelerate', 'TG: Call to Action widget button redirect link' . $this->id, $button_url ); + } + echo $before_widget; ?>
@@ -85,7 +93,12 @@ function widget( $args, $instance ) { -

+

id, $text_main ); + } + echo esc_html( $text_main ); ?>

id, $text ); + } + $page_array = array(); for( $i=0; $i<4; $i++ ) { $var = 'page_id'.$i; @@ -86,7 +92,14 @@ function widget( $args, $instance ) { ) ); echo $before_widget; if ( !empty( $title ) ) { echo $before_title . esc_html( $title ) . $after_title; } - if ( !empty( $text ) ) { echo '

'.esc_textarea( $text ).'

'; } + if ( !empty( $text ) ) { ?> +

id, $text ); + } + echo '

'.esc_textarea( $text ).'

'; ?>

+ have_posts() ):$get_featured_pages->the_post(); $page_title = get_the_title(); diff --git a/wpml-config.xml b/wpml-config.xml index d250b43..1a26d64 100644 --- a/wpml-config.xml +++ b/wpml-config.xml @@ -7,11 +7,5 @@ - - - - - - From dc98b611c7890cd5954657f43b675dc8ccea7060 Mon Sep 17 00:00:00 2001 From: ankitkarki17 Date: Tue, 20 Oct 2020 23:12:57 +0545 Subject: [PATCH 08/11] Update Changelog --- .../accelerate-call-to-action-widget.php | 107 +++++++------ inc/widgets/accelerate-recent-work-widget.php | 145 +++++++++++------- 2 files changed, 148 insertions(+), 104 deletions(-) diff --git a/inc/widgets/accelerate-call-to-action-widget.php b/inc/widgets/accelerate-call-to-action-widget.php index d3d4776..b908989 100644 --- a/inc/widgets/accelerate-call-to-action-widget.php +++ b/inc/widgets/accelerate-call-to-action-widget.php @@ -5,44 +5,47 @@ class accelerate_call_to_action_widget extends WP_Widget { function __construct() { - $widget_ops = array( + $widget_ops = array( 'classname' => 'widget_call_to_action', 'description' => __( 'Use this widget to show the call to action section.', 'accelerate' ), 'customize_selective_refresh' => true, ); - $control_ops = array( 'width' => 200, 'height' =>250 ); - parent::__construct( false, $name = __( 'TG: Call To Action Widget', 'accelerate' ), $widget_ops, $control_ops); + $control_ops = array( + 'width' => 200, + 'height' => 250, + ); + parent::__construct( false, $name = __( 'TG: Call To Action Widget', 'accelerate' ), $widget_ops, $control_ops ); } function form( $instance ) { - $accelerate_defaults[ 'text_main' ] = ''; - $accelerate_defaults[ 'text_additional' ] = ''; - $accelerate_defaults[ 'button_text' ] = ''; - $accelerate_defaults[ 'button_url' ] = ''; - $accelerate_defaults[ 'new_tab' ] = '0'; - $instance = wp_parse_args( (array) $instance, $accelerate_defaults ); - $text_main = esc_textarea( $instance[ 'text_main' ] ); - $text_additional = esc_textarea( $instance[ 'text_additional' ] ); - $button_text = esc_attr( $instance[ 'button_text' ] ); - $button_url = esc_url( $instance[ 'button_url' ] ); - $new_tab = $instance['new_tab'] ? 'checked="checked"' : ''; + $accelerate_defaults['text_main'] = ''; + $accelerate_defaults['text_additional'] = ''; + $accelerate_defaults['button_text'] = ''; + $accelerate_defaults['button_url'] = ''; + $accelerate_defaults['new_tab'] = '0'; + $instance = wp_parse_args( (array) $instance, $accelerate_defaults ); + $text_main = esc_textarea( $instance['text_main'] ); + $text_additional = esc_textarea( $instance['text_additional'] ); + $button_text = esc_attr( $instance['button_text'] ); + $button_url = esc_url( $instance['button_url'] ); + $new_tab = $instance['new_tab'] ? 'checked="checked"' : ''; ?> - - - - + + + +

- - + +

- - + +

- id="get_field_id('new_tab'); ?>" name="get_field_name('new_tab'); ?>" /> + id="get_field_id( 'new_tab' ); ?>" name="get_field_name( 'new_tab' ); ?>" />

-

+ id, $text_main ); - } - echo esc_html( $text_main ); ?>

+ if ( function_exists( 'icl_t' ) ) { + $text_main = icl_t( 'Accelerate', 'TG: Call to Action widget main text' . $this->id, $text_main ); + } + echo esc_html( $text_main ); + ?> +

+ - href="" title=""> + href="" title=""> diff --git a/inc/widgets/accelerate-recent-work-widget.php b/inc/widgets/accelerate-recent-work-widget.php index ff04d2d..5ad41ec 100644 --- a/inc/widgets/accelerate-recent-work-widget.php +++ b/inc/widgets/accelerate-recent-work-widget.php @@ -5,42 +5,53 @@ class accelerate_recent_work_widget extends WP_Widget { function __construct() { - $widget_ops = array( - 'classname' => 'widget_recent_work', - 'description' => __( 'Show your some pages as recent work. Best for Business Top or Bottom sidebar.', 'accelerate' ), + $widget_ops = array( + 'classname' => 'widget_recent_work', + 'description' => __( 'Show your some pages as recent work. Best for Business Top or Bottom sidebar.', 'accelerate' ), 'customize_selective_refresh' => true, ); - $control_ops = array( 'width' => 200, 'height' =>250 ); - parent::__construct( false, $name = __( 'TG: Featured Widget', 'accelerate' ), $widget_ops, $control_ops); + $control_ops = array( + 'width' => 200, + 'height' => 250, + ); + parent::__construct( false, $name = __( 'TG: Featured Widget', 'accelerate' ), $widget_ops, $control_ops ); } function form( $instance ) { - $defaults = array(); - $defaults[ 'title' ] = ''; - $defaults[ 'text' ] = ''; - for ( $i=0; $i<4; $i++ ) { - $var = 'page_id'.$i; - $defaults[$var] = ''; + $defaults = array(); + $defaults['title'] = ''; + $defaults['text'] = ''; + for ( $i = 0; $i < 4; $i++ ) { + $var = 'page_id' . $i; + $defaults[ $var ] = ''; } $instance = wp_parse_args( (array) $instance, $defaults ); - $title = esc_attr( $instance['title'] ); - $text = esc_textarea($instance['text']); - for ( $i=0; $i<4; $i++ ) { - $var = 'page_id'.$i; + $title = esc_attr( $instance['title'] ); + $text = esc_textarea( $instance['text'] ); + for ( $i = 0; $i < 4; $i++ ) { + $var = 'page_id' . $i; $var = absint( $instance[ $var ] ); } ?>

- - + +

- - - + + +

- - ' ','name' => $this->get_field_name( 'page_id'.$i ), 'selected' => $instance[ 'page_id'.$i ] ) ); ?> + + ' ', + 'name' => $this->get_field_name( 'page_id' . $i ), + 'selected' => $instance[ 'page_id' . $i ], + ) + ); + ?>

-1, - 'post_type' => array( 'page' ), - 'post__in' => $page_array, - 'orderby' => 'post__in' - ) ); + $get_featured_pages = new WP_Query( + array( + 'posts_per_page' => -1, + 'post_type' => array( 'page' ), + 'post__in' => $page_array, + 'orderby' => 'post__in', + ) + ); echo $before_widget; - if ( !empty( $title ) ) { echo $before_title . esc_html( $title ) . $after_title; } - if ( !empty( $text ) ) { ?> -

+

+ id, $text ); - } - echo '

'.esc_textarea( $text ).'

'; ?>

- id, $text ); + } + echo '

' . esc_textarea( $text ) . '

'; + ?> +

+ have_posts() ):$get_featured_pages->the_post(); + while ( $get_featured_pages->have_posts() ) : + $get_featured_pages->the_post(); $page_title = get_the_title(); - if ( $i % 4 == 0 ) { $class = 'tg-one-fourth tg-one-fourth-last'.' tg-column-'.$i; } - elseif( $i % 3 == 0 ) { $class= 'tg-one-fourth tg-after-two-blocks-clearfix'.' tg-column-'.$i; } - else { $class = 'tg-one-fourth'.' tg-column-'.$i; } - ?> + if ( $i % 4 == 0 ) { + $class = 'tg-one-fourth tg-one-fourth-last' . ' tg-column-' . $i; } elseif ( $i % 3 == 0 ) { + $class = 'tg-one-fourth tg-after-two-blocks-clearfix' . ' tg-column-' . $i; } else { + $class = 'tg-one-fourth' . ' tg-column-' . $i; } + ?> '; + echo ''; } ?>
- '.$page_title.''; ?> + ' . $page_title . ''; ?>
- From c094df625dc8b29678fc0cd8f727d8a7c50d62cb Mon Sep 17 00:00:00 2001 From: ankitkarki17 Date: Tue, 20 Oct 2020 23:12:57 +0545 Subject: [PATCH 09/11] Refactor code --- .../accelerate-call-to-action-widget.php | 107 +++++++------ inc/widgets/accelerate-recent-work-widget.php | 145 +++++++++++------- 2 files changed, 148 insertions(+), 104 deletions(-) diff --git a/inc/widgets/accelerate-call-to-action-widget.php b/inc/widgets/accelerate-call-to-action-widget.php index d3d4776..b908989 100644 --- a/inc/widgets/accelerate-call-to-action-widget.php +++ b/inc/widgets/accelerate-call-to-action-widget.php @@ -5,44 +5,47 @@ class accelerate_call_to_action_widget extends WP_Widget { function __construct() { - $widget_ops = array( + $widget_ops = array( 'classname' => 'widget_call_to_action', 'description' => __( 'Use this widget to show the call to action section.', 'accelerate' ), 'customize_selective_refresh' => true, ); - $control_ops = array( 'width' => 200, 'height' =>250 ); - parent::__construct( false, $name = __( 'TG: Call To Action Widget', 'accelerate' ), $widget_ops, $control_ops); + $control_ops = array( + 'width' => 200, + 'height' => 250, + ); + parent::__construct( false, $name = __( 'TG: Call To Action Widget', 'accelerate' ), $widget_ops, $control_ops ); } function form( $instance ) { - $accelerate_defaults[ 'text_main' ] = ''; - $accelerate_defaults[ 'text_additional' ] = ''; - $accelerate_defaults[ 'button_text' ] = ''; - $accelerate_defaults[ 'button_url' ] = ''; - $accelerate_defaults[ 'new_tab' ] = '0'; - $instance = wp_parse_args( (array) $instance, $accelerate_defaults ); - $text_main = esc_textarea( $instance[ 'text_main' ] ); - $text_additional = esc_textarea( $instance[ 'text_additional' ] ); - $button_text = esc_attr( $instance[ 'button_text' ] ); - $button_url = esc_url( $instance[ 'button_url' ] ); - $new_tab = $instance['new_tab'] ? 'checked="checked"' : ''; + $accelerate_defaults['text_main'] = ''; + $accelerate_defaults['text_additional'] = ''; + $accelerate_defaults['button_text'] = ''; + $accelerate_defaults['button_url'] = ''; + $accelerate_defaults['new_tab'] = '0'; + $instance = wp_parse_args( (array) $instance, $accelerate_defaults ); + $text_main = esc_textarea( $instance['text_main'] ); + $text_additional = esc_textarea( $instance['text_additional'] ); + $button_text = esc_attr( $instance['button_text'] ); + $button_url = esc_url( $instance['button_url'] ); + $new_tab = $instance['new_tab'] ? 'checked="checked"' : ''; ?> - - - - + + + +

- - + +

- - + +

- id="get_field_id('new_tab'); ?>" name="get_field_name('new_tab'); ?>" /> + id="get_field_id( 'new_tab' ); ?>" name="get_field_name( 'new_tab' ); ?>" />

-

+ id, $text_main ); - } - echo esc_html( $text_main ); ?>

+ if ( function_exists( 'icl_t' ) ) { + $text_main = icl_t( 'Accelerate', 'TG: Call to Action widget main text' . $this->id, $text_main ); + } + echo esc_html( $text_main ); + ?> +

+ - href="" title=""> + href="" title=""> diff --git a/inc/widgets/accelerate-recent-work-widget.php b/inc/widgets/accelerate-recent-work-widget.php index ff04d2d..5ad41ec 100644 --- a/inc/widgets/accelerate-recent-work-widget.php +++ b/inc/widgets/accelerate-recent-work-widget.php @@ -5,42 +5,53 @@ class accelerate_recent_work_widget extends WP_Widget { function __construct() { - $widget_ops = array( - 'classname' => 'widget_recent_work', - 'description' => __( 'Show your some pages as recent work. Best for Business Top or Bottom sidebar.', 'accelerate' ), + $widget_ops = array( + 'classname' => 'widget_recent_work', + 'description' => __( 'Show your some pages as recent work. Best for Business Top or Bottom sidebar.', 'accelerate' ), 'customize_selective_refresh' => true, ); - $control_ops = array( 'width' => 200, 'height' =>250 ); - parent::__construct( false, $name = __( 'TG: Featured Widget', 'accelerate' ), $widget_ops, $control_ops); + $control_ops = array( + 'width' => 200, + 'height' => 250, + ); + parent::__construct( false, $name = __( 'TG: Featured Widget', 'accelerate' ), $widget_ops, $control_ops ); } function form( $instance ) { - $defaults = array(); - $defaults[ 'title' ] = ''; - $defaults[ 'text' ] = ''; - for ( $i=0; $i<4; $i++ ) { - $var = 'page_id'.$i; - $defaults[$var] = ''; + $defaults = array(); + $defaults['title'] = ''; + $defaults['text'] = ''; + for ( $i = 0; $i < 4; $i++ ) { + $var = 'page_id' . $i; + $defaults[ $var ] = ''; } $instance = wp_parse_args( (array) $instance, $defaults ); - $title = esc_attr( $instance['title'] ); - $text = esc_textarea($instance['text']); - for ( $i=0; $i<4; $i++ ) { - $var = 'page_id'.$i; + $title = esc_attr( $instance['title'] ); + $text = esc_textarea( $instance['text'] ); + for ( $i = 0; $i < 4; $i++ ) { + $var = 'page_id' . $i; $var = absint( $instance[ $var ] ); } ?>

- - + +

- - - + + +

- - ' ','name' => $this->get_field_name( 'page_id'.$i ), 'selected' => $instance[ 'page_id'.$i ] ) ); ?> + + ' ', + 'name' => $this->get_field_name( 'page_id' . $i ), + 'selected' => $instance[ 'page_id' . $i ], + ) + ); + ?>

-1, - 'post_type' => array( 'page' ), - 'post__in' => $page_array, - 'orderby' => 'post__in' - ) ); + $get_featured_pages = new WP_Query( + array( + 'posts_per_page' => -1, + 'post_type' => array( 'page' ), + 'post__in' => $page_array, + 'orderby' => 'post__in', + ) + ); echo $before_widget; - if ( !empty( $title ) ) { echo $before_title . esc_html( $title ) . $after_title; } - if ( !empty( $text ) ) { ?> -

+

+ id, $text ); - } - echo '

'.esc_textarea( $text ).'

'; ?>

- id, $text ); + } + echo '

' . esc_textarea( $text ) . '

'; + ?> +

+ have_posts() ):$get_featured_pages->the_post(); + while ( $get_featured_pages->have_posts() ) : + $get_featured_pages->the_post(); $page_title = get_the_title(); - if ( $i % 4 == 0 ) { $class = 'tg-one-fourth tg-one-fourth-last'.' tg-column-'.$i; } - elseif( $i % 3 == 0 ) { $class= 'tg-one-fourth tg-after-two-blocks-clearfix'.' tg-column-'.$i; } - else { $class = 'tg-one-fourth'.' tg-column-'.$i; } - ?> + if ( $i % 4 == 0 ) { + $class = 'tg-one-fourth tg-one-fourth-last' . ' tg-column-' . $i; } elseif ( $i % 3 == 0 ) { + $class = 'tg-one-fourth tg-after-two-blocks-clearfix' . ' tg-column-' . $i; } else { + $class = 'tg-one-fourth' . ' tg-column-' . $i; } + ?> '; + echo ''; } ?>
- '.$page_title.''; ?> + ' . $page_title . ''; ?>
- From f38a3764a41570ca1776d522ff5365edf19741a7 Mon Sep 17 00:00:00 2001 From: ankitkarki17 Date: Wed, 21 Oct 2020 16:07:00 +0545 Subject: [PATCH 10/11] Add compatibility --- inc/header-functions.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/inc/header-functions.php b/inc/header-functions.php index 67d9eb2..de06495 100644 --- a/inc/header-functions.php +++ b/inc/header-functions.php @@ -75,6 +75,13 @@ function accelerate_featured_image_slider() { $image_alt = get_post_meta( $attachment_post_id, '_wp_attachment_image_alt', true ); $image_alt_text = ! empty( $image_alt ) ? $image_alt : $accelerate_slider_title; + // For WPML plugin compatibility + if ( function_exists( 'icl_register_string' ) ) { + icl_register_string( 'Accelerate', 'Slider Title ' . $i, $accelerate_slider_title ); + icl_register_string( 'Accelerate', 'Slider Description ' . $i, $accelerate_slider_text ); + icl_register_string( 'Accelerate', 'Slider Button Link ' . $i, $accelerate_slider_link ); + icl_register_string( 'Accelerate', 'Slider Image Link ' . $i, $accelerate_slider_image ); + } if ( ! empty( $accelerate_header_title ) || ! empty( $accelerate_slider_text ) || ! empty( $accelerate_slider_image ) ) { if ( $i == 1 ) { @@ -90,6 +97,15 @@ function accelerate_featured_image_slider() { } ?>
+
<?php echo esc_attr( $image_alt_text ); ?>
From ac0eafe2448e5bd8da3045eca722c6868b984d9f Mon Sep 17 00:00:00 2001 From: ankitkarki17 Date: Wed, 21 Oct 2020 16:08:47 +0545 Subject: [PATCH 11/11] Refactor code --- inc/header-functions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/header-functions.php b/inc/header-functions.php index de06495..10062f0 100644 --- a/inc/header-functions.php +++ b/inc/header-functions.php @@ -85,15 +85,15 @@ function accelerate_featured_image_slider() { if ( ! empty( $accelerate_header_title ) || ! empty( $accelerate_slider_text ) || ! empty( $accelerate_slider_image ) ) { if ( $i == 1 ) { - $classes = "slides displayblock"; + $classes = 'slides displayblock'; } else { - $classes = "slides displaynone"; + $classes = 'slides displaynone'; } if ( $accelerate_slide_text_position == 'left' ) { - $classes2 = "entry-container entry-container-left"; + $classes2 = 'entry-container entry-container-left'; } else { - $classes2 = "entry-container"; + $classes2 = 'entry-container'; } ?>