-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlatest-posts-widget.php
More file actions
89 lines (70 loc) · 2.48 KB
/
latest-posts-widget.php
File metadata and controls
89 lines (70 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
* Latest Posts Widget
*
* @package Latest Posts Widget
* @author Tirtharaj Pati
* @copyright 2025 Tirtharaj Pati
* @license GPL-2.0-or-later
*
* @wordpress-plugin
* Plugin Name: Latest Posts Widget
* Plugin URI: https://github.com/Tirthagit/wordpress-latest-post-widget-plugin/
* Description: This is a plugin to show latest posts in a widget format and also allows to categorising the posts. Simple and flexible.
* Version: 1.0.0
* Requires at least: 6.4.5
* Requires PHP: 7.4.3
* Author: Tirtharaj Pati
* Author URI: https://example.com
* Text Domain: latestpostswidget
* License: GPL v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Update URI: https://github.com/Tirthagit/wordpress-latest-post-widget-plugin/
*/
declare(strict_types=1);
// define('THEME_VERSION', '1.0.0');
// Prevent direct access
defined('ABSPATH') || die("You don't have access to this file");
if (file_exists(__DIR__ . "/vendor/autoload.php")) {
require_once __DIR__ . "/vendor/autoload.php";
}
use LatestPostWidget\Includes\Admin\LPWAdminMenu as AdminMenu;
use \LatestPostWidget\Includes\Init as Init;
use \LatestPostWidget\Includes\Base\Activate as Activate;
use \LatestPostWidget\Includes\Base\Deactivate as Deactivate;
// Activate Plugin
if (!function_exists(('lpw_activate'))) {
function lpw_activate()
{
Activate::activate();
}
}
register_activation_hook(__FILE__, 'lpw_activate');
// Deactivate Plugin
if (!function_exists(('lpw_deactivate'))) {
function lpw_deactivate()
{
Deactivate::deactivate();
}
}
register_deactivation_hook(__FILE__, 'lpw_deactivate');
if (class_exists("LatestPostWidget\\Includes\\Init")) {
Init::register_services();
}
if (class_exists("LatestPostWidget\\Includes\\Admin\\LPWAdminMenu")) {
new AdminMenu();
}
if (!function_exists('load_admin_stylesheet')) {
function load_admin_stylesheet()
{
wp_enqueue_style('latestpostwidgetadminstyle', plugin_dir_url(__FILE__) . '/assets/css/style.css', [], '1.0.0');
}
}
add_action('admin_enqueue_scripts', 'load_admin_stylesheet');
if (!function_exists('load_admin_javascript')) {
function load_admin_javascript()
{
wp_enqueue_script('latestpostwidgetadminscript', plugin_dir_url(__FILE__) . '/assets/js/script.js', array('jquery'), '1.0.0');
}
}
add_action('admin_enqueue_scripts', 'load_admin_javascript');