Skip to content

Commit 237be53

Browse files
committed
Fix viewport meta tag. Props to Alex Stine
1 parent 7eaa89d commit 237be53

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

divi-accessibility.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Plugin Name: Divi Accessibility
1717
* Plugin URI: https://wordpress.org/plugins/accessible-divi/
1818
* Description: Improve Divi accessibility in accordance with WCAG 2.0 guidelines.
19-
* Version: 1.0.1
19+
* Version: 1.0.2
2020
* Author: CampusPress
2121
* Author URI: https://campuspress.com
2222
* License: GPL-2.0+

includes/class-divi-accessibility.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ class Divi_Accessibility {
8787
* Load the dependencies, define the locale, and set the hooks for the admin area and
8888
* the public-facing side of the site.
8989
*
90-
* @since 1.0.0
90+
* @since 1.0.2
9191
*/
9292
public function __construct() {
9393

9494
$this->da11y = 'divi_accessibility';
9595
$this->da11y_options = 'divi_accessibility_options';
96-
$this->version = '1.0.1';
96+
$this->version = '1.0.2';
9797

9898
$this->load_dependencies();
9999
$this->load_settings();
@@ -174,6 +174,8 @@ private function define_public_hooks() {
174174
$this->loader->add_action( 'wp_head', $plugin_public, 'embedded_styles' );
175175
$this->loader->add_action( 'wp_footer', $plugin_public, 'embedded_scripts' );
176176
$this->loader->add_action( 'wp_footer', $plugin_public, 'developer_mode' );
177+
$this->loader->add_action( 'init', $plugin_public, 'remove_divi_viewport_meta' );
178+
$this->loader->add_action( 'wp_head', $plugin_public, 'accessible_viewport_meta' );
177179

178180
}
179181

public/class-divi-accessibility-public.php

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function __construct( $da11y, $da11y_options, $version, $settings ) {
7979
/**
8080
* Render the gemerated CSS for the plugin.
8181
*
82-
* @since 1.0.0
82+
* @since 1.0.0
8383
*/
8484
public function embedded_styles() {
8585
include_once 'partials/divi-accessibility-embedded-css.php';
@@ -88,12 +88,30 @@ public function embedded_styles() {
8888
/**
8989
* Render the gemerated JS for the plugin.
9090
*
91-
* @since 1.0.0
91+
* @since 1.0.0
9292
*/
9393
public function embedded_scripts() {
9494
include_once 'partials/divi-accessibility-embedded-js.php';
9595
}
9696

97+
/**
98+
* Remove Divi viewport meta since we want to load our own.
99+
*
100+
* @since 1.0.2
101+
*/
102+
public function remove_divi_viewport_meta() {
103+
remove_action( 'wp_head', 'et_add_viewport_meta' );
104+
}
105+
106+
/**
107+
* Allow users to pinch and zoom divi theme.
108+
*
109+
* @since 1.0.2
110+
*/
111+
public function accessible_viewport_meta() {
112+
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0 />';
113+
}
114+
97115
/**
98116
* Register the JavaScript for the public-facing side of the site.
99117
*

0 commit comments

Comments
 (0)