PWE Elements AutoSwitch #4 in Multisite & Networks
A plugin that allows for intelligent rendering of components (elements) depending on the assigned domain group
by Anton Melnychuk · github.com/ptak-warsaw-expo-dev/pwe-elements-auto-switch · website
Install
The author publishes release zips, so WP-CLI can install straight from GitHub:
wp plugin install https://github.com/ptak-warsaw-expo-dev/pwe-elements-auto-switch/releases/download/1.8.0/pwe-elements-auto-switch.1.8.0.zipDeclares an update source (https://github.com/ptak-warsaw-expo-dev/pwe-elements-auto-switch/releases/latest), so updates arrive through the plugin's own updater.
Readme
🧩 PWE Elements AutoSwitch
Dynamiczne elementy WordPress, które automatycznie dostosowują się do grup domen. Ta wtyczka pozwala na inteligentne renderowanie komponentów (elementów) w zależności od przypisanej grupy domen, ułatwiając zarządzanie wieloma wersjami stron w ramach jednego motywu.
🚀 Funkcjonalność
PWE Elements AutoSwitch automatycznie przełącza zestawy elementów i ich konfiguracje w zależności od aktualnej domeny lub grupy, do której dana domena należy.
Główne możliwości:
🔁 Dynamiczne przełączanie elementów w zależności od domeny (grupy).
🧱 Integracja z WPBakery Page Builder – automatyczna rejestracja shortcode’ów i bloków.
🪶 Automatyczne ładowanie stylów i skryptów (zarówno wspólnych, jak i specyficznych dla grupy).
⚙️ Łatwe dodawanie nowych elementów poprzez definicję w PWE_Elements_Data.
🧰 Obsługa wielu układów stron (main, catalog i inne).
🔒 Opcjonalna integracja z autoupdaterem GitHub (z prywatnym tokenem API).
📁 Struktura wtyczki
pwe-elements-auto-switch/
│
├── pwe-elements-auto-switch.php # Główny plik wtyczki
├── includes/
│ ├── class-groups.php # Definicja grup domen
│ ├── class-elements.php # Obsługa shortcode’ów, stylów, skryptów
│ ├── class-elements-data.php # Lista elementów i ich kolejność
│ ├── class-functions.php # Pomocnicze funkcje
│
├── assets/
│ ├── style.css # Główne style
│ ├── style-gr1.css # Style specyficzne dla grupy
│ ├── script.js # Skrypty JS
│
└── elements/
├── main/ # Elementy strony głównej
├── catalog/ # Elementy katalogu wystawców
🧠 Jak to działa
Wtyczka wykrywa domenę i przypisuje ją do jednej z grup zdefiniowanych w PWE_Groups.
Na podstawie grupy wybierane są odpowiednie style, skrypty i zestaw elementów.
Elementy są renderowane według kolejności i typu określonego w PWE_Elements_Data.
Shortcode’y (np. [pwe-elements-auto-switch-page-main]) generują kompletną strukturę strony.
⚙️ Dostępne shortcode’y Shortcode Opis Typ strony [pwe-elements-auto-switch-page-main] Renderuje główną stronę wydarzenia z dynamicznymi komponentami main [pwe-elements-auto-switch-page-catalog] Renderuje stronę katalogu wystawców catalog ...
🧩 Dodawanie nowego elementu
Aby dodać nowy element:
Utwórz plik PHP z klasą np. Hero_Section w katalogu elements/main/hero-section/hero-section.php.
Zdefiniuj w nim metody get_data() i render().
Dodaj wpis w tablicy self::$elements_files w class-elements-data.php, np.:
['class' => 'Hero_Section', 'file' => 'elements/main/hero-section/hero-section.php', 'order' => ['gr1' => 2, 'gr2' => 3, 'b2c' => 2]],
🧑💻 Wymagania
WordPress 6.0+
PHP 7.4 lub wyższy
(Opcjonalnie) WPBakery Page Builder
🛠 Instalacja
Pobierz najnowsze wydanie z Releases .
Wgraj folder pwe-elements-auto-switch do katalogu /wp-content/plugins/.
Aktywuj wtyczkę w panelu WordPress → Wtyczki.
Dodaj shortcode na wybranej stronie.
👨💻 Autorzy
PWE Web Developers https://github.com/ptak-warsaw-expo-dev
📜 Licence
Ten projekt jest objęty licencją GPL v2 lub nowszą. Szczegóły: https://www.gnu.org/licenses/gpl-2.0.html
Read the full README on GitHub →
Releases
| Tag | Published | Asset | Downloads |
|---|---|---|---|
| 1.8.0 | Sep 2, 2026 | pwe-elements-auto-switch.1.8.0.zip | 233 |
| 1.7.9 | Aug 28, 2026 | pwe-elements-auto-switch.1.7.9.zip | 212 |
| 1.7.8 | Aug 25, 2026 | pwe-elements-auto-switch.1.7.8.zip | 212 |
| 1.7.7 | Aug 21, 2026 | pwe-elements-auto-switch.1.7.7.zip | 210 |
| 1.7.6 | Aug 20, 2026 | pwe-elements-auto-switch.1.7.6.zip | 210 |
| 1.7.5 | Aug 19, 2026 | pwe-elements-auto-switch.1.7.5.zip | 193 |
| 1.7.4 | Aug 19, 2026 | pwe-elements-auto-switch.1.7.4.zip | 28 |
| 1.7.3 | Aug 19, 2026 | pwe-elements-auto-switch.1.7.3.zip | 24 |
| 1.7.2 | Aug 19, 2026 | pwe-elements-auto-switch.1.7.2.zip | 31 |
| 3.7.1 | Aug 18, 2026 | pwe-elements-auto-switch.1.7.1.zip | 202 |
| 1.7.0 | Aug 17, 2026 | pwe-elements-auto-switch.1.7.0.zip | 214 |
| 1.6.9 | Aug 12, 2026 | pwe-elements-auto-switch.1.6.9.zip | 202 |
| 1.6.8 | Aug 10, 2026 | pwe-elements-auto-switch.1.6.8.zip | 208 |
| 1.6.7 | Aug 10, 2026 | pwe-elements-auto-switch.1.6.7.zip | 147 |
| 1.6.6 | Aug 10, 2026 | pwe-elements-auto-switch.1.6.6.zip | 34 |
| 1.6.5 | Jul 30, 2026 | pwe-elements-auto-switch.1.6.5.zip | 216 |
| 1.6.4 | Jul 23, 2026 | pwe-elements-auto-switch.1.6.4.zip | 210 |
| 1.6.3 | Jul 23, 2026 | pwe-elements-auto-switch.1.6.3.zip | 26 |
| 1.6.2 | Jul 22, 2026 | pwe-elements-auto-switch.1.6.2.zip | 202 |
| 1.6.1 | Jul 22, 2026 | pwe-elements-auto-switch.1.6.1.zip | 62 |
| 1.6.0 | Jul 17, 2026 | pwe-elements-auto-switch.1.6.0.zip | 200 |
| 1.5.9 | Jul 14, 2026 | pwe-elements-auto-switch.1.5.9.zip | 207 |
| 1.5.8 | Jul 9, 2026 | pwe-elements-auto-switch.1.5.8.zip | 206 |
| 1.5.7 | Jul 3, 2026 | pwe-elements-auto-switch.1.5.7.zip | 207 |
| 1.5.6 | Jun 30, 2026 | pwe-elements-auto-switch.1.5.6.zip | 205 |
Active-site estimate ≈210 comes from the 1.7.0 cohort. Method.