diff --git a/beep.php b/beep.php index a2288cd..c8a9117 100755 --- a/beep.php +++ b/beep.php @@ -2,7 +2,7 @@ /** * Plugin Name: Beep * Description: A Twitter-style microblog for WordPress, with likes, replies, and Gravatars. Use the [beep_feed] shortcode on any page. - * Version: 1.6.8 + * Version: 1.7.0 * Requires at least: 6.0 * Requires PHP: 7.4 * Author: Sami Ahmed @@ -14,7 +14,7 @@ if (!defined('ABSPATH')) { exit; } -define('BEEP_VERSION', '1.6.8'); +define('BEEP_VERSION', '1.7.0'); define('BEEP_FILE', __FILE__); define('BEEP_DIR', plugin_dir_path(__FILE__)); define('BEEP_URL', plugin_dir_url(__FILE__)); diff --git a/includes/class-beep.php b/includes/class-beep.php index 94cd2a3..14f5449 100755 --- a/includes/class-beep.php +++ b/includes/class-beep.php @@ -22,12 +22,12 @@ class Beep_Plugin { // Elementor widget — only load if Elementor is active add_action('elementor/widgets/register', function ($widgets_manager) { - if (!class_exists('\Elementor\Widget_Base')) return; + if (!class_exists('\\Elementor\\Widget_Base')) return; $widget_file = BEEP_DIR . 'includes/class-elementor-widget.php'; if (!file_exists($widget_file)) return; require_once $widget_file; - if (class_exists('\Elementor\Beep_Elementor_Widget')) { - $widgets_manager->register(new \Elementor\Beep_Elementor_Widget()); + if (class_exists('\\Elementor\\Beep_Elementor_Widget')) { + $widgets_manager->register(new \\Elementor\\Beep_Elementor_Widget()); } }, 5); @@ -35,6 +35,18 @@ class Beep_Plugin { add_action('admin_menu', [__CLASS__, 'add_admin_menu']); add_action('admin_init', [__CLASS__, 'register_settings']); } + // Don't inject in feeds, REST, admin, etc. + if (is_feed() || is_admin() || (defined('REST_REQUEST') && REST_REQUEST)) { + return $content; + } + // Don't double-inject if content already has a beep feed + if (strpos($content, 'data-beep-feed') !== false) { + return $content; + } + + $feed = do_shortcode('[beep_feed limit="10"]'); + return $feed . $content; + } public static function add_admin_menu() { add_options_page(