v1.7.0: shortcode-only, remove auto-inject
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* Plugin Name: Beep
|
* Plugin Name: Beep
|
||||||
* Description: A Twitter-style microblog for WordPress, with likes, replies, and Gravatars. Use the [beep_feed] shortcode on any page.
|
* 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 at least: 6.0
|
||||||
* Requires PHP: 7.4
|
* Requires PHP: 7.4
|
||||||
* Author: Sami Ahmed
|
* Author: Sami Ahmed
|
||||||
@@ -14,7 +14,7 @@ if (!defined('ABSPATH')) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
define('BEEP_VERSION', '1.6.8');
|
define('BEEP_VERSION', '1.7.0');
|
||||||
define('BEEP_FILE', __FILE__);
|
define('BEEP_FILE', __FILE__);
|
||||||
define('BEEP_DIR', plugin_dir_path(__FILE__));
|
define('BEEP_DIR', plugin_dir_path(__FILE__));
|
||||||
define('BEEP_URL', plugin_dir_url(__FILE__));
|
define('BEEP_URL', plugin_dir_url(__FILE__));
|
||||||
|
|||||||
+15
-3
@@ -22,12 +22,12 @@ class Beep_Plugin {
|
|||||||
|
|
||||||
// Elementor widget — only load if Elementor is active
|
// Elementor widget — only load if Elementor is active
|
||||||
add_action('elementor/widgets/register', function ($widgets_manager) {
|
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';
|
$widget_file = BEEP_DIR . 'includes/class-elementor-widget.php';
|
||||||
if (!file_exists($widget_file)) return;
|
if (!file_exists($widget_file)) return;
|
||||||
require_once $widget_file;
|
require_once $widget_file;
|
||||||
if (class_exists('\Elementor\Beep_Elementor_Widget')) {
|
if (class_exists('\\Elementor\\Beep_Elementor_Widget')) {
|
||||||
$widgets_manager->register(new \Elementor\Beep_Elementor_Widget());
|
$widgets_manager->register(new \\Elementor\\Beep_Elementor_Widget());
|
||||||
}
|
}
|
||||||
}, 5);
|
}, 5);
|
||||||
|
|
||||||
@@ -35,6 +35,18 @@ class Beep_Plugin {
|
|||||||
add_action('admin_menu', [__CLASS__, 'add_admin_menu']);
|
add_action('admin_menu', [__CLASS__, 'add_admin_menu']);
|
||||||
add_action('admin_init', [__CLASS__, 'register_settings']);
|
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() {
|
public static function add_admin_menu() {
|
||||||
add_options_page(
|
add_options_page(
|
||||||
|
|||||||
Reference in New Issue
Block a user