From e7f5108b76434a9fd3bf0a92278f38383bac5118 Mon Sep 17 00:00:00 2001 From: Cooper Dalrymple Date: Mon, 22 Dec 2025 14:59:32 -0600 Subject: [PATCH] Add shortcode --- inc/display.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/inc/display.php b/inc/display.php index 2a90981..aa790b4 100644 --- a/inc/display.php +++ b/inc/display.php @@ -2,7 +2,8 @@ /** * @package CleverOgre * @subpackage OgreAlert - * @since OgreAlert 0.1.9 + * @version 0.2.2 + * @since 0.1.9 */ namespace OgreAlert; @@ -15,6 +16,7 @@ class Display { if (is_admin()) return; add_action('wp', [__CLASS__, 'init']); + add_shortcode('ogrealert', [__CLASS__, 'shortcode']); } static function init() { @@ -69,6 +71,13 @@ class Display { return $classes; } + static function shortcode($atts) { + $atts = shortcode_atts([], $atts, 'ogrealert'); + ob_start(); + do_action('display_alerts'); + return ob_get_clean(); + } + private static function load_template($filename, $filepart = '', $echo = true, $vars = []) { $path = \OgreAlert\Settings::get('path') . 'templates/' . $filename . '-' . $filepart . '.php'; if (!file_exists($path)) {