diff --git a/plugin/inc/functions.php b/plugin/inc/functions.php
index 75daf434..3f710115 100644
--- a/plugin/inc/functions.php
+++ b/plugin/inc/functions.php
@@ -17,6 +17,15 @@
function plugin() {
static $plugin = null;
+ /**
+ * Check if the requirements for the current plugin are met.
+ * If the requirements are not met, we might get severe errors. Therefore, we
+ * return null and do not initialize the plugin.
+ */
+ if ( ! plugin_requirements_are_met() ) {
+ return null;
+ }
+
if ( null === $plugin ) {
/**
* The main plugin component.
@@ -45,3 +54,43 @@ function plugin_container() {
return $container;
}
+
+/**
+ * Check if the requirements for the current plugin are met.
+ *
+ * @return bool True if requirements are met, false otherwise.
+ */
+function plugin_requirements_are_met() {
+ /**
+ * Advanced Custom Fields Pro is required.
+ */
+ if ( ! function_exists( '\acf_add_options_page' ) ) {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Display an admin notice if the requirements are not met.
+ */
+function plugin_requirements_notice__error() {
+ if ( plugin_requirements_are_met() ) {
+ return;
+ }
+
+ ?>
+
+
+ ' . esc_html__( 'LHPBP Plugin', 'lhpbp' ) . ''
+ );
+ ?>
+
+
+ get_plugin_slug(),
__FILE__, // Full path to the main plugin file or functions.php.
diff --git a/schemas/theme.json b/schemas/theme.json
index 44572bf8..6bc7f266 100644
--- a/schemas/theme.json
+++ b/schemas/theme.json
@@ -463,9 +463,31 @@
"px",
"em",
"rem",
- "vh",
+ "%",
"vw",
- "%"
+ "svw",
+ "lvw",
+ "dvw",
+ "vh",
+ "svh",
+ "lvh",
+ "dvh",
+ "vi",
+ "svi",
+ "lvi",
+ "dvi",
+ "vb",
+ "svb",
+ "lvb",
+ "dvb",
+ "vmin",
+ "svmin",
+ "lvmin",
+ "dvmin",
+ "vmax",
+ "svmax",
+ "lvmax",
+ "dvmax"
],
"default": "rem"
}
diff --git a/theme/inc/functions.php b/theme/inc/functions.php
index 9915eb26..ba993137 100644
--- a/theme/inc/functions.php
+++ b/theme/inc/functions.php
@@ -37,6 +37,7 @@ function theme() {
/**
* Check if the requirements for the current theme are met.
+ * The only requirement for the theme is the accompanying plugin.
*
* @return bool True if requirements are met, false otherwise.
*/
@@ -48,13 +49,6 @@ function theme_requirements_are_met() {
return false;
}
- /**
- * The Advanced Custom Fields plugin is required.
- */
- if ( ! function_exists( 'get_field' ) ) {
- return false;
- }
-
return true;
}
@@ -63,7 +57,7 @@ function theme_requirements_are_met() {
*/
function requirements_template() {
if ( ! theme_requirements_are_met() ) {
- wp_die( 'The requirements for this theme are not met.' );
+ wp_die( 'The requirements for this theme are not met. Please install and activate the accompanying plugin.' );
}
}
add_action( 'template_redirect', '\WpMunich\lhpbp\theme\requirements_template' );
@@ -77,7 +71,7 @@ function theme_requirements_notice__error() {
}
$class = 'notice notice-error';
- $message = 'The requirements for this theme are not met.';
+ $message = 'The requirements for this theme are not met. Please install and activate the accompanying plugin.';
printf( '', esc_attr( $class ), esc_html( $message ) );
}