-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple-post-like.php
More file actions
52 lines (43 loc) · 1.63 KB
/
simple-post-like.php
File metadata and controls
52 lines (43 loc) · 1.63 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
<?php
/**
* Plugin Name: Simple Post Like
* Description: Add simple, intuitive reactions to your posts.
* Plugin URI: https://www.fronttheme.com/products/simple-post-like
* Version: 1.0.0
* Author: FrontTheme
* Author URI: https://www.fronttheme.com
* Text Domain: simple-post-like
* Domain Path: /languages/
* License: GPLv2 or later
* Copyright: FrontTheme
* Requires at least: 6.8
* Requires PHP: 8.0
*/
use FrontTheme\SimplePostLike\Install;
use FrontTheme\SimplePostLike\Plugin;
defined( 'ABSPATH' ) || exit;
define( 'SIMPLE_POST_LIKE_FILE', __FILE__ );
define( 'SIMPLE_POST_LIKE_VERSION', '1.0.0' );
define( 'SIMPLE_POST_LIKE_PATH', plugin_dir_path( __FILE__ ) );
define( 'SIMPLE_POST_LIKE_URL', plugin_dir_url( __FILE__ ) );
// Load Composer autoloader.
if ( file_exists( SIMPLE_POST_LIKE_PATH . 'vendor/autoload.php' ) ) {
require_once SIMPLE_POST_LIKE_PATH . 'vendor/autoload.php';
}
// Initialize the plugin.
Plugin::instance();
/**
* Render the like button for a post.
*
* @param int $post_id Post ID. Defaults to current post.
* @param string $style Display style override. Empty string uses global setting.
*
* @return string Like button HTML.
*/
function spl_like_button( int $post_id = 0, string $style = '' ): string {
$post_id = $post_id > 0 ? $post_id : (int) get_the_ID();
$override = $style !== '' ? $style : null;
return \FrontTheme\SimplePostLike\LikeButton::instance()->get_like_button_html( $post_id, $override );
}
register_activation_hook( __FILE__, [ Install::instance(), 'activate' ] );
register_deactivation_hook( __FILE__, [ Install::instance(), 'deactivate' ] );