Version Description
- Updated language switcher dropdown animated & toogle on mobile.
- Added Elementor icon in posts list status.
- Fixed language switcher underline style.
- Fixed SVG flags if encoded is disabled.
- SVG flags data URIs don't need base64 and save some bytes.
Download this release
Release Info
Developer | pacotole |
Plugin | Polylang Connect for Elementor – Templates Translation & Language Switcher |
Version | 2.0.3 |
Comparing to | |
See all releases |
Code changes from version 2.0.2 to 2.0.3
- README.txt +25 -26
- assets/css/language-switcher.css +48 -11
- assets/css/language-switcher.min.css +1 -1
- connect-polylang-elementor.php +2 -2
- includes/admin-extras.php +21 -1
- includes/widgets/polylang-language-switcher.php +5 -3
README.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: elementor, polylang, multilingual, language switcher, languages, templates
|
|
5 |
Requires at least: 5.4
|
6 |
Tested up to: 5.9
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 2.0.
|
9 |
License: GPL-2.0-or-later
|
10 |
License URI: https://opensource.org/licenses/GPL-2.0
|
11 |
|
@@ -20,7 +20,7 @@ Connect Polylang multilingual plugin with Elementor Page Builder: **Translate yo
|
|
20 |
### What the Plugin Does
|
21 |
|
22 |
#### 📍 Template translation and show in the correct language
|
23 |
-
Create translations for your Elementor templates especially for
|
24 |
|
25 |
#### 🔄 Language Switcher
|
26 |
A native Elementor Widget to easily build a nice and fully customizable language switcher:
|
@@ -84,13 +84,13 @@ Site languages:
|
|
84 |
* [**Plugin's support forum**](https://wordpress.org/support/plugin/connect-polylang-elementor) here on WordPress.org
|
85 |
* [Github plugin repo](https://github.com/creame/connect-polylang-elementor)
|
86 |
* [Polylang User Community Group at Facebook](https://www.facebook.com/groups/polylang.users/)
|
87 |
-
* **What is covered by our support?** - All regarding **THIS plugin** ("
|
88 |
* **What is NOT covered by support?** - Anything general regarding multilingual topics and WordPress. Explicitely we **DO NOT** offer any "WPML", "WPBakery" or "Visual Composer" support, and also not for your theme etc.!!!
|
89 |
|
90 |
### Translations
|
91 |
We have used the strings of Elementor and Polylang whenever possible to take advantage of the fact that they are translated into many languages. For the other strings a `.pot` file (`connect-polylang-elementor.pot`) for translators is also always included :)
|
92 |
|
93 |
-
You can collaborate with your language
|
94 |
|
95 |
### Credits
|
96 |
The following code/classes are licensed under the GPL.
|
@@ -101,8 +101,6 @@ The following code/classes are licensed under the GPL.
|
|
101 |
* v1. Polylang Switcher class (Elementor Widget) and its CSS based on widget from plugin "Language Switcher for Elementor" by Solitweb (GPLv2 or later)
|
102 |
* SVG flags from [FlagKit](https://github.com/madebybowtie/FlagKit) and [Wikipedia](https://wikipedia.org/)
|
103 |
|
104 |
-
Enjoy using *Polylang Connect for Elementor*? [**Please consider making a donation**](https://www.paypal.me/pacotole) to support the project's continued development.
|
105 |
-
|
106 |
Please, send your suggestions and feedback - Thank you for using or trying out this plugin!
|
107 |
|
108 |
|
@@ -113,7 +111,7 @@ Please, send your suggestions and feedback - Thank you for using or trying out t
|
|
113 |
|
114 |
* WordPress version 4.7 or higher
|
115 |
* [Elementor](https://wordpress.org/plugins/elementor/) and [Polylang](https://wordpress.org/plugins/polylang/) plugins - free versions from WordPress.org Plugin Directory
|
116 |
-
* **
|
117 |
|
118 |
= Installation =
|
119 |
|
@@ -121,7 +119,7 @@ Please, send your suggestions and feedback - Thank you for using or trying out t
|
|
121 |
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
122 |
4. Assign languages to your pages/posts/Elementor templates
|
123 |
5. For Elementor templates: set display conditions in Elementor for the main language template only, templates in the other languages will then get loaded via this plugin magically! :)
|
124 |
-
6. Additionally use the native Elementor Widget:
|
125 |
|
126 |
|
127 |
|
@@ -146,19 +144,21 @@ This plugin has NO settings page, as it does not need one. All it does works jus
|
|
146 |
|
147 |
|
148 |
= Is Elementor Pro required? =
|
149 |
-
Technically, Elementor Pro is not required
|
|
|
|
|
150 |
|
151 |
-
Elementor
|
|
|
|
|
152 |
|
153 |
-
|
154 |
-
* Dynamic Tags, additionally added by the plugin
|
155 |
|
156 |
-
For the other features of the plugin the regular free version of Elementor is sufficient - so the native Elementor language switcher widget will work also that way already ;-)
|
157 |
|
|
|
|
|
158 |
|
159 |
-
|
160 |
-
Yes, it is! :)
|
161 |
-
All features of "Polylang Connect for Elementor" work with both, *Polylang* (free) AND *Polylang Pro* (Premium).
|
162 |
|
163 |
|
164 |
= Are custom flags supported? =
|
@@ -172,21 +172,13 @@ To use a different size for custom flags we are trying to find ways to implement
|
|
172 |
In the Polylang Switcher Elementor widget there are typography settings available for the Switcher menu items. These settings are CSS based of course, and applied "globally" to the various states they are for: normal, hover, active (current language). The available toggles for uppercase are done code-wise and therefore have a lower priority - this means the CSS always takes over, if wanted. That way you are most flexible with quick settings (toggles) but have all styling options at hand if needed.
|
173 |
|
174 |
|
175 |
-
= Is Elementor plugin needed? =
|
176 |
-
Yes, it is. Otherwise this connect plugin won't do anything. Elementor is available for free on WordPress.org.
|
177 |
-
|
178 |
-
The Elementor Pro Add-On plugin is needed for the Theme Builder capabilities (for example Header templates), plus the feature of "Dynamic Tags". So it is highly recommended. But if it is not installed/ activated, the depending features from the connect plugin won't even load. So it is all optional.
|
179 |
-
|
180 |
-
The language switcher widget only needs Elementor base plugin to work ;-)
|
181 |
-
|
182 |
-
|
183 |
= Other recommended plugins for multilingual websites? =
|
184 |
There are quite a few:
|
185 |
|
186 |
* [**Polylang Pro** (Premium)](https://polylang.pro/downloads/polylang-pro/) - The official premium version with more features, plus premium support
|
187 |
* [**Polylang for WooCommerce** (Premium)](https://polylang.pro/downloads/polylang-for-woocommerce/) - Makes WooCommerce multilingual - official Polylang Add-On
|
188 |
* [**Lingotek Translation**](https://wordpress.org/plugins/lingotek-translation/) - Native Polylang integration - Lingotek brings convenient cloud-based localization and translation for WordPress
|
189 |
-
* [**
|
190 |
* [**Country Flags for Elementor**](https://wordpress.org/plugins/country-flags-for-elementor/) - Native Elementor widget
|
191 |
|
192 |
|
@@ -202,6 +194,13 @@ There are quite a few:
|
|
202 |
|
203 |
== Changelog ==
|
204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
= 2.0.2 =
|
206 |
Fixed fatal error if call home_url() before initialize Polylang.
|
207 |
|
@@ -283,7 +282,7 @@ Fixed critical error loading plugin classes when there are uppercase letters in
|
|
283 |
|
284 |
== Upgrade Notice ==
|
285 |
|
286 |
-
= 2.0.
|
287 |
**Warning** breaking changes with v1. Language Switcher and Dynamic Tags has been renamed and neeed to re-added again in your templates.
|
288 |
|
289 |
= 1.0.2 =
|
5 |
Requires at least: 5.4
|
6 |
Tested up to: 5.9
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 2.0.3
|
9 |
License: GPL-2.0-or-later
|
10 |
License URI: https://opensource.org/licenses/GPL-2.0
|
11 |
|
20 |
### What the Plugin Does
|
21 |
|
22 |
#### 📍 Template translation and show in the correct language
|
23 |
+
Create translations for your Elementor templates especially for header, footer or archive templates with [**Elementor Pro Theme Builder**](https://trk.elementor.com/5l8mc0eyt38p-theme-builder) *(affiliated link)*.
|
24 |
|
25 |
#### 🔄 Language Switcher
|
26 |
A native Elementor Widget to easily build a nice and fully customizable language switcher:
|
84 |
* [**Plugin's support forum**](https://wordpress.org/support/plugin/connect-polylang-elementor) here on WordPress.org
|
85 |
* [Github plugin repo](https://github.com/creame/connect-polylang-elementor)
|
86 |
* [Polylang User Community Group at Facebook](https://www.facebook.com/groups/polylang.users/)
|
87 |
+
* **What is covered by our support?** - All regarding **THIS plugin** ("Polylang Connect for Elementor"), plus the relation to *Polylang*, *Polylang Pro*, *Elementor* and *Elementor Pro* of course.
|
88 |
* **What is NOT covered by support?** - Anything general regarding multilingual topics and WordPress. Explicitely we **DO NOT** offer any "WPML", "WPBakery" or "Visual Composer" support, and also not for your theme etc.!!!
|
89 |
|
90 |
### Translations
|
91 |
We have used the strings of Elementor and Polylang whenever possible to take advantage of the fact that they are translated into many languages. For the other strings a `.pot` file (`connect-polylang-elementor.pot`) for translators is also always included :)
|
92 |
|
93 |
+
You can collaborate with your language translations in [Translating WordPress](https://translate.wordpress.org/projects/wp-plugins/connect-polylang-elementor)
|
94 |
|
95 |
### Credits
|
96 |
The following code/classes are licensed under the GPL.
|
101 |
* v1. Polylang Switcher class (Elementor Widget) and its CSS based on widget from plugin "Language Switcher for Elementor" by Solitweb (GPLv2 or later)
|
102 |
* SVG flags from [FlagKit](https://github.com/madebybowtie/FlagKit) and [Wikipedia](https://wikipedia.org/)
|
103 |
|
|
|
|
|
104 |
Please, send your suggestions and feedback - Thank you for using or trying out this plugin!
|
105 |
|
106 |
|
111 |
|
112 |
* WordPress version 4.7 or higher
|
113 |
* [Elementor](https://wordpress.org/plugins/elementor/) and [Polylang](https://wordpress.org/plugins/polylang/) plugins - free versions from WordPress.org Plugin Directory
|
114 |
+
* **Recommended:** [**Elementor Pro**](https://trk.elementor.com/5l8mc0eyt38p) *(affiliate link)* which is needed for Theme Building possibilities (header, footer, 404, archive templates, etc.) and Dynamic Tags.
|
115 |
|
116 |
= Installation =
|
117 |
|
119 |
2. Activate the plugin through the 'Plugins' menu in WordPress.
|
120 |
4. Assign languages to your pages/posts/Elementor templates
|
121 |
5. For Elementor templates: set display conditions in Elementor for the main language template only, templates in the other languages will then get loaded via this plugin magically! :)
|
122 |
+
6. Additionally use the native Elementor Widget: Language Switcher
|
123 |
|
124 |
|
125 |
|
144 |
|
145 |
|
146 |
= Is Elementor Pro required? =
|
147 |
+
Technically, Elementor Pro is not required **but highly recommended**.
|
148 |
+
|
149 |
+
[**Elementor Pro**](https://trk.elementor.com/5l8mc0eyt38p-pro) *(affiliate link)* is required for these features of the plugin:
|
150 |
|
151 |
+
* Translate Elementor Theme Builder Templates (header, footer, 404, page, archives).
|
152 |
+
* Translate Elementor Popups.
|
153 |
+
* Dynamic Tags, additionally added by the plugin.
|
154 |
|
155 |
+
For the other features of the plugin the free version of Elementor is sufficient - so the native Elementor language switcher widget will work ;-)
|
|
|
156 |
|
|
|
157 |
|
158 |
+
= Is Polylang Pro required? =
|
159 |
+
Polylang Pro is not required.
|
160 |
|
161 |
+
All features of "Polylang Connect for Elementor" work with both, *Polylang* and *Polylang Pro*.
|
|
|
|
|
162 |
|
163 |
|
164 |
= Are custom flags supported? =
|
172 |
In the Polylang Switcher Elementor widget there are typography settings available for the Switcher menu items. These settings are CSS based of course, and applied "globally" to the various states they are for: normal, hover, active (current language). The available toggles for uppercase are done code-wise and therefore have a lower priority - this means the CSS always takes over, if wanted. That way you are most flexible with quick settings (toggles) but have all styling options at hand if needed.
|
173 |
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
= Other recommended plugins for multilingual websites? =
|
176 |
There are quite a few:
|
177 |
|
178 |
* [**Polylang Pro** (Premium)](https://polylang.pro/downloads/polylang-pro/) - The official premium version with more features, plus premium support
|
179 |
* [**Polylang for WooCommerce** (Premium)](https://polylang.pro/downloads/polylang-for-woocommerce/) - Makes WooCommerce multilingual - official Polylang Add-On
|
180 |
* [**Lingotek Translation**](https://wordpress.org/plugins/lingotek-translation/) - Native Polylang integration - Lingotek brings convenient cloud-based localization and translation for WordPress
|
181 |
+
* [**Elementor Datepicker Localization**](https://github.com/creame/elementor-datepicker-localization) - Allow form datetime fields in your site language
|
182 |
* [**Country Flags for Elementor**](https://wordpress.org/plugins/country-flags-for-elementor/) - Native Elementor widget
|
183 |
|
184 |
|
194 |
|
195 |
== Changelog ==
|
196 |
|
197 |
+
= 2.0.3 =
|
198 |
+
* Updated language switcher dropdown animated & toogle on mobile.
|
199 |
+
* Added Elementor icon in posts list status.
|
200 |
+
* Fixed language switcher underline style.
|
201 |
+
* Fixed SVG flags if encoded is disabled.
|
202 |
+
* SVG flags data URIs don't need base64 and save some bytes.
|
203 |
+
|
204 |
= 2.0.2 =
|
205 |
Fixed fatal error if call home_url() before initialize Polylang.
|
206 |
|
282 |
|
283 |
== Upgrade Notice ==
|
284 |
|
285 |
+
= 2.0.3 =
|
286 |
**Warning** breaking changes with v1. Language Switcher and Dynamic Tags has been renamed and neeed to re-added again in your templates.
|
287 |
|
288 |
= 1.0.2 =
|
assets/css/language-switcher.css
CHANGED
@@ -29,11 +29,39 @@
|
|
29 |
|
30 |
/* Dropdown layout */
|
31 |
.cpel-switcher--layout-dropdown .cpel-switcher__nav {
|
32 |
-
display: inline-
|
33 |
-
|
|
|
|
|
|
|
|
|
34 |
position: relative;
|
35 |
}
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
.cpel-switcher--layout-dropdown.cpel-switcher--align-left .elementor-widget-container {
|
38 |
text-align: left;
|
39 |
}
|
@@ -52,22 +80,26 @@
|
|
52 |
|
53 |
.cpel-switcher--layout-dropdown .cpel-switcher__list {
|
54 |
position: absolute;
|
55 |
-
z-index:
|
56 |
top: 100%;
|
57 |
-
|
58 |
-
min-width: 100%;
|
59 |
-
display: none;
|
60 |
flex-direction: column;
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
|
63 |
-
.cpel-switcher--layout-dropdown .cpel-
|
64 |
-
|
65 |
-
display: flex;
|
66 |
}
|
67 |
|
68 |
-
.cpel-switcher--layout-dropdown .cpel-switcher__lang
|
69 |
-
.cpel-switcher--layout-dropdown .cpel-switcher__lang a {
|
70 |
width: 100%;
|
|
|
|
|
|
|
|
|
71 |
text-align: left;
|
72 |
}
|
73 |
|
@@ -155,6 +187,11 @@ body.rtl .cpel-switcher--layout-horizontal .cpel-switcher__lang:not(:last-child)
|
|
155 |
vertical-align: middle;
|
156 |
}
|
157 |
|
|
|
|
|
|
|
|
|
|
|
158 |
.cpel-switcher__flag {
|
159 |
line-height: .5em;
|
160 |
}
|
29 |
|
30 |
/* Dropdown layout */
|
31 |
.cpel-switcher--layout-dropdown .cpel-switcher__nav {
|
32 |
+
display: inline-block;
|
33 |
+
position: relative;
|
34 |
+
user-select: none;
|
35 |
+
}
|
36 |
+
|
37 |
+
.cpel-switcher--layout-dropdown .cpel-switcher__toggle {
|
38 |
position: relative;
|
39 |
}
|
40 |
|
41 |
+
.cpel-switcher--layout-dropdown .cpel-switcher__toggle::after {
|
42 |
+
content: '';
|
43 |
+
position: absolute;
|
44 |
+
z-index: 2;
|
45 |
+
top: 0;
|
46 |
+
right: 0;
|
47 |
+
bottom: 0;
|
48 |
+
width: 100%;
|
49 |
+
cursor: pointer;
|
50 |
+
}
|
51 |
+
|
52 |
+
.cpel-switcher--layout-dropdown .cpel-switcher__toggle a i {
|
53 |
+
transition: transform 200ms ease-in-out;
|
54 |
+
}
|
55 |
+
|
56 |
+
.cpel-switcher--layout-dropdown .cpel-switcher__toggle.cpel-switcher__toggle--on::after {
|
57 |
+
width: min(33%, 2.5em);
|
58 |
+
}
|
59 |
+
|
60 |
+
.cpel-switcher--layout-dropdown .cpel-switcher__toggle.cpel-switcher__toggle--on a i {
|
61 |
+
transform: rotateX(180deg);
|
62 |
+
}
|
63 |
+
|
64 |
+
|
65 |
.cpel-switcher--layout-dropdown.cpel-switcher--align-left .elementor-widget-container {
|
66 |
text-align: left;
|
67 |
}
|
80 |
|
81 |
.cpel-switcher--layout-dropdown .cpel-switcher__list {
|
82 |
position: absolute;
|
83 |
+
z-index: 10;
|
84 |
top: 100%;
|
85 |
+
display: flex;
|
|
|
|
|
86 |
flex-direction: column;
|
87 |
+
min-width: 100%;
|
88 |
+
max-height: 0;
|
89 |
+
overflow: hidden;
|
90 |
+
transition: max-height 200ms ease-in-out;
|
91 |
}
|
92 |
|
93 |
+
.cpel-switcher--layout-dropdown .cpel-switcher__toggle--on+.cpel-switcher__list {
|
94 |
+
max-height: 300px;
|
|
|
95 |
}
|
96 |
|
97 |
+
.cpel-switcher--layout-dropdown .cpel-switcher__lang {
|
|
|
98 |
width: 100%;
|
99 |
+
}
|
100 |
+
|
101 |
+
.cpel-switcher--layout-dropdown .cpel-switcher__lang a {
|
102 |
+
display: block;
|
103 |
text-align: left;
|
104 |
}
|
105 |
|
187 |
vertical-align: middle;
|
188 |
}
|
189 |
|
190 |
+
.cpel-switcher__name,
|
191 |
+
.cpel-switcher__code {
|
192 |
+
text-decoration: inherit;
|
193 |
+
}
|
194 |
+
|
195 |
.cpel-switcher__flag {
|
196 |
line-height: .5em;
|
197 |
}
|
assets/css/language-switcher.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.cpel-switcher__nav{--cpel-switcher-space:0;display:block}.cpel-switcher__nav .cpel-switcher__list{display:flex;list-style:none;margin:0;padding:0;line-height:normal;-webkit-tap-highlight-color:rgba(0,0,0,0)}.cpel-switcher__nav a{display:inline-block;text-decoration:none;white-space:nowrap}.cpel-switcher--layout-horizontal .cpel-switcher__list{flex-direction:row;flex-wrap:wrap}.cpel-switcher--layout-vertical .cpel-switcher__list{flex-direction:column}.cpel-switcher--layout-dropdown .cpel-switcher__nav{display:inline-
|
1 |
+
.cpel-switcher__nav{--cpel-switcher-space:0;display:block}.cpel-switcher__nav .cpel-switcher__list{display:flex;list-style:none;margin:0;padding:0;line-height:normal;-webkit-tap-highlight-color:rgba(0,0,0,0)}.cpel-switcher__nav a{display:inline-block;text-decoration:none;white-space:nowrap}.cpel-switcher--layout-horizontal .cpel-switcher__list{flex-direction:row;flex-wrap:wrap}.cpel-switcher--layout-vertical .cpel-switcher__list{flex-direction:column}.cpel-switcher--layout-dropdown .cpel-switcher__nav{display:inline-block;position:relative;user-select:none}.cpel-switcher--layout-dropdown .cpel-switcher__toggle{position:relative}.cpel-switcher--layout-dropdown .cpel-switcher__toggle:after{content:"";position:absolute;z-index:2;top:0;right:0;bottom:0;width:100%;cursor:pointer}.cpel-switcher--layout-dropdown .cpel-switcher__toggle a i{transition:transform .2s ease-in-out}.cpel-switcher--layout-dropdown .cpel-switcher__toggle.cpel-switcher__toggle--on:after{width:min(33%,2.5em)}.cpel-switcher--layout-dropdown .cpel-switcher__toggle.cpel-switcher__toggle--on a i{transform:rotateX(180deg)}.cpel-switcher--layout-dropdown.cpel-switcher--align-left .elementor-widget-container{text-align:left}.cpel-switcher--layout-dropdown.cpel-switcher--align-center .elementor-widget-container{text-align:center}.cpel-switcher--layout-dropdown.cpel-switcher--align-right .elementor-widget-container{text-align:right}.cpel-switcher--layout-dropdown.cpel-switcher--align-justify .cpel-switcher__nav{display:flex}.cpel-switcher--layout-dropdown .cpel-switcher__list{position:absolute;z-index:10;top:100%;display:flex;flex-direction:column;min-width:100%;max-height:0;overflow:hidden;transition:max-height .2s ease-in-out}.cpel-switcher--layout-dropdown .cpel-switcher__toggle--on+.cpel-switcher__list{max-height:300px}.cpel-switcher--layout-dropdown .cpel-switcher__lang{width:100%}.cpel-switcher--layout-dropdown .cpel-switcher__lang a{display:block;text-align:left}.cpel-switcher--align-left .cpel-switcher__list{align-items:flex-start}.cpel-switcher--align-center .cpel-switcher__list{align-items:center}.cpel-switcher--align-right .cpel-switcher__list{align-items:flex-end}.cpel-switcher--align-justify .cpel-switcher__list{align-items:stretch}.cpel-switcher--align-justify a{width:100%;text-align:center}.cpel-switcher--layout-dropdown.cpel-switcher--align-right .cpel-switcher__list{right:0;left:auto}.cpel-switcher--layout-dropdown.cpel-switcher--align-justify .cpel-switcher__toggle a{display:inline-flex;justify-content:flex-start;align-items:center}.cpel-switcher--layout-dropdown.cpel-switcher--align-justify .cpel-switcher__icon{margin-right:0;margin-left:auto}.cpel-switcher--layout-horizontal.cpel-switcher--align-left .cpel-switcher__list{justify-content:flex-start}.cpel-switcher--layout-horizontal.cpel-switcher--align-center .cpel-switcher__list{justify-content:center}.cpel-switcher--layout-horizontal.cpel-switcher--align-right .cpel-switcher__list{justify-content:flex-end}.cpel-switcher--layout-horizontal.cpel-switcher--align-justify .cpel-switcher__lang{flex-grow:1}.cpel-switcher__lang{margin:0}.cpel-switcher--layout-horizontal .cpel-switcher__lang:not(:last-child){margin-right:var(--cpel-switcher-space)}body.rtl .cpel-switcher--layout-horizontal .cpel-switcher__lang:not(:last-child){margin-left:var(--cpel-switcher-space)}.cpel-switcher--layout-vertical .cpel-switcher__lang:not(:last-child){margin-bottom:var(--cpel-switcher-space)}.cpel-switcher__code,.cpel-switcher__flag,.cpel-switcher__name{display:inline-block;vertical-align:middle}.cpel-switcher__code,.cpel-switcher__name{text-decoration:inherit}.cpel-switcher__flag{line-height:.5em}.cpel-switcher__flag img{width:100%;max-width:100%;height:100%;object-fit:cover;object-position:center}.cpel-switcher__flag--ai img,.cpel-switcher__flag--au img,.cpel-switcher__flag--aw img,.cpel-switcher__flag--bm img,.cpel-switcher__flag--bs img,.cpel-switcher__flag--by img,.cpel-switcher__flag--cd img,.cpel-switcher__flag--ck img,.cpel-switcher__flag--cl img,.cpel-switcher__flag--cn img,.cpel-switcher__flag--cu img,.cpel-switcher__flag--cz img,.cpel-switcher__flag--dj img,.cpel-switcher__flag--er img,.cpel-switcher__flag--es img,.cpel-switcher__flag--esperanto img,.cpel-switcher__flag--fj img,.cpel-switcher__flag--fk img,.cpel-switcher__flag--gq img,.cpel-switcher__flag--gr img,.cpel-switcher__flag--gs img,.cpel-switcher__flag--gw img,.cpel-switcher__flag--gy img,.cpel-switcher__flag--hm img,.cpel-switcher__flag--io img,.cpel-switcher__flag--jo img,.cpel-switcher__flag--km img,.cpel-switcher__flag--kw img,.cpel-switcher__flag--ky img,.cpel-switcher__flag--kz img,.cpel-switcher__flag--lk img,.cpel-switcher__flag--lr img,.cpel-switcher__flag--mg img,.cpel-switcher__flag--mh img,.cpel-switcher__flag--ms img,.cpel-switcher__flag--my img,.cpel-switcher__flag--mz img,.cpel-switcher__flag--na img,.cpel-switcher__flag--np img,.cpel-switcher__flag--nu img,.cpel-switcher__flag--nz img,.cpel-switcher__flag--om img,.cpel-switcher__flag--ph img,.cpel-switcher__flag--pm img,.cpel-switcher__flag--pn img,.cpel-switcher__flag--pr img,.cpel-switcher__flag--ps img,.cpel-switcher__flag--sb img,.cpel-switcher__flag--sc img,.cpel-switcher__flag--sd img,.cpel-switcher__flag--sg img,.cpel-switcher__flag--sh img,.cpel-switcher__flag--sk img,.cpel-switcher__flag--ss img,.cpel-switcher__flag--st img,.cpel-switcher__flag--tc img,.cpel-switcher__flag--tf img,.cpel-switcher__flag--tg img,.cpel-switcher__flag--tk img,.cpel-switcher__flag--tl img,.cpel-switcher__flag--to img,.cpel-switcher__flag--tv img,.cpel-switcher__flag--tw img,.cpel-switcher__flag--us img,.cpel-switcher__flag--uy img,.cpel-switcher__flag--uz img,.cpel-switcher__flag--vg img,.cpel-switcher__flag--vu img,.cpel-switcher__flag--ws img,.cpel-switcher__flag--za img,.cpel-switcher__flag--zw img{object-position:left}.cpel-switcher__flag--eh img,.cpel-switcher__flag--tm img{object-position:20%}.cpel-switcher__flag--ai img,.cpel-switcher__flag--au img,.cpel-switcher__flag--bm img,.cpel-switcher__flag--ck img,.cpel-switcher__flag--fj img,.cpel-switcher__flag--fk img,.cpel-switcher__flag--gs img,.cpel-switcher__flag--hm img,.cpel-switcher__flag--io img,.cpel-switcher__flag--ky img,.cpel-switcher__flag--ms img,.cpel-switcher__flag--nu img,.cpel-switcher__flag--nz img,.cpel-switcher__flag--pn img,.cpel-switcher__flag--sh img,.cpel-switcher__flag--tc img,.cpel-switcher__flag--tf img,.cpel-switcher__flag--tv img,.cpel-switcher__flag--vg img{object-position:75%}.cpel-switcher__flag--as img,.cpel-switcher__flag--zm img{object-position:right}
|
connect-polylang-elementor.php
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
* Plugin Name: Polylang Connect for Elementor
|
9 |
* Plugin URI: https://github.com/creame/connect-polylang-elementor
|
10 |
* Description: Connect Polylang with Elementor. Display templates in the correct language, language switcher widget, language visibility conditions and dynamic tags.
|
11 |
-
* Version: 2.0.
|
12 |
* Author: Creame
|
13 |
* Author URI: https://crea.me/
|
14 |
* License: GPL-2.0-or-later
|
@@ -31,7 +31,7 @@ defined( 'ABSPATH' ) || exit;
|
|
31 |
*
|
32 |
* @since 2.0.0
|
33 |
*/
|
34 |
-
define( 'CPEL_PLUGIN_VERSION', '2.0.
|
35 |
define( 'CPEL_FILE', __FILE__ );
|
36 |
define( 'CPEL_DIR', plugin_dir_path( CPEL_FILE ) );
|
37 |
define( 'CPEL_BASENAME', plugin_basename( CPEL_FILE ) );
|
8 |
* Plugin Name: Polylang Connect for Elementor
|
9 |
* Plugin URI: https://github.com/creame/connect-polylang-elementor
|
10 |
* Description: Connect Polylang with Elementor. Display templates in the correct language, language switcher widget, language visibility conditions and dynamic tags.
|
11 |
+
* Version: 2.0.3
|
12 |
* Author: Creame
|
13 |
* Author URI: https://crea.me/
|
14 |
* License: GPL-2.0-or-later
|
31 |
*
|
32 |
* @since 2.0.0
|
33 |
*/
|
34 |
+
define( 'CPEL_PLUGIN_VERSION', '2.0.3' );
|
35 |
define( 'CPEL_FILE', __FILE__ );
|
36 |
define( 'CPEL_DIR', plugin_dir_path( CPEL_FILE ) );
|
37 |
define( 'CPEL_BASENAME', plugin_basename( CPEL_FILE ) );
|
includes/admin-extras.php
CHANGED
@@ -20,6 +20,8 @@ class AdminExtras {
|
|
20 |
|
21 |
add_filter( 'plugin_row_meta', array( $this, 'plugin_links' ), 10, 2 );
|
22 |
|
|
|
|
|
23 |
}
|
24 |
|
25 |
/**
|
@@ -80,7 +82,6 @@ class AdminExtras {
|
|
80 |
|
81 |
}
|
82 |
|
83 |
-
|
84 |
/**
|
85 |
* Add various support links to Plugins page.
|
86 |
*
|
@@ -104,4 +105,23 @@ class AdminExtras {
|
|
104 |
|
105 |
}
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
}
|
20 |
|
21 |
add_filter( 'plugin_row_meta', array( $this, 'plugin_links' ), 10, 2 );
|
22 |
|
23 |
+
add_filter( 'display_post_states', array( $this, 'elementor_post_state_icon' ), 100 );
|
24 |
+
|
25 |
}
|
26 |
|
27 |
/**
|
82 |
|
83 |
}
|
84 |
|
|
|
85 |
/**
|
86 |
* Add various support links to Plugins page.
|
87 |
*
|
105 |
|
106 |
}
|
107 |
|
108 |
+
/**
|
109 |
+
* Replace "Elementor" post state with icon
|
110 |
+
*
|
111 |
+
* @since 2.0.3
|
112 |
+
*
|
113 |
+
* @param array $states
|
114 |
+
* @return array
|
115 |
+
*/
|
116 |
+
function elementor_post_state_icon( $states ) {
|
117 |
+
|
118 |
+
if ( isset( $states['elementor'] ) && apply_filters( 'cpel/filter/elementor_icon', true ) ) {
|
119 |
+
unset( $states['elementor'] );
|
120 |
+
return array( 'elementor' => '<i class="eicon-elementor-square" title="Elementor" style="color:#93003c;"></i>' ) + $states;
|
121 |
+
}
|
122 |
+
|
123 |
+
return $states;
|
124 |
+
|
125 |
+
}
|
126 |
+
|
127 |
}
|
includes/widgets/polylang-language-switcher.php
CHANGED
@@ -730,10 +730,12 @@ class PolylangLanguageSwitcher extends Widget_Base {
|
|
730 |
|
731 |
if ( 'yes' === $settings['svg_flag'] && $flag_svg ) {
|
732 |
|
733 |
-
// If
|
734 |
if ( ! defined( 'PLL_ENCODED_FLAGS' ) || PLL_ENCODED_FLAGS ) {
|
735 |
$file_contents = file_get_contents( CPEL_DIR . $flag_svg['path'] ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
|
736 |
-
$flag_svg['src'] = 'data:image/svg+xml;
|
|
|
|
|
737 |
}
|
738 |
|
739 |
$language_flag = \PLL_Language::get_flag_html( $flag_svg, '', $language['name'] );
|
@@ -774,7 +776,7 @@ class PolylangLanguageSwitcher extends Widget_Base {
|
|
774 |
$lang_link = str_replace( '</a>', '<i ' . $this->get_render_attribute_string( 'icon' ) . '></i></a>', $lang_link );
|
775 |
}
|
776 |
|
777 |
-
$output .= '<div class="cpel-switcher__toggle cpel-switcher__lang">' . $lang_link . '</div>';
|
778 |
}
|
779 |
|
780 |
// Languages list
|
730 |
|
731 |
if ( 'yes' === $settings['svg_flag'] && $flag_svg ) {
|
732 |
|
733 |
+
// If data uri encoded flags are preferred.
|
734 |
if ( ! defined( 'PLL_ENCODED_FLAGS' ) || PLL_ENCODED_FLAGS ) {
|
735 |
$file_contents = file_get_contents( CPEL_DIR . $flag_svg['path'] ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
|
736 |
+
$flag_svg['src'] = 'data:image/svg+xml;utf8,' . str_replace( array( '#', '"' ), array( '%23', "'" ), $file_contents );
|
737 |
+
} else {
|
738 |
+
$flag_svg['src'] = $flag_svg['url'];
|
739 |
}
|
740 |
|
741 |
$language_flag = \PLL_Language::get_flag_html( $flag_svg, '', $language['name'] );
|
776 |
$lang_link = str_replace( '</a>', '<i ' . $this->get_render_attribute_string( 'icon' ) . '></i></a>', $lang_link );
|
777 |
}
|
778 |
|
779 |
+
$output .= '<div class="cpel-switcher__toggle cpel-switcher__lang" onclick="this.classList.toggle(\'cpel-switcher__toggle--on\')">' . $lang_link . '</div>';
|
780 |
}
|
781 |
|
782 |
// Languages list
|