-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflex-posts.php
More file actions
96 lines (87 loc) · 2.71 KB
/
flex-posts.php
File metadata and controls
96 lines (87 loc) · 2.71 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
87
88
89
90
91
92
93
94
95
96
<?php
/**
* Plugin Name: Flex Posts - Widget and Gutenberg Block
* Plugin URI: https://tajam.id/flex-posts/
* Description: A widget to display posts with thumbnails in various layouts for any widget area.
* Version: 1.8.1
* Author: Tajam
* Author URI: https://tajam.id/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: flex-posts
* Domain Path: /languages
*
* Flex Posts is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* any later version.
*
* Flex Posts is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Flex Posts. If not, see http://www.gnu.org/licenses/gpl-2.0.txt
*
* @package Flex Posts
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Current plugin version.
*/
define( 'FLEX_POSTS_VERSION', '1.8.1' );
/**
* Plugin directory and url
*/
define( 'FLEX_POSTS_DIR', plugin_dir_path( __FILE__ ) );
define( 'FLEX_POSTS_URL', plugin_dir_url( __FILE__ ) );
/**
* Include functions & widget classes
*/
require FLEX_POSTS_DIR . 'includes/functions.php';
require FLEX_POSTS_DIR . 'includes/form-helpers.php';
require FLEX_POSTS_DIR . 'includes/class-flex-posts-widget.php';
require FLEX_POSTS_DIR . 'includes/class-flex-posts-list.php';
/**
* Include template functions in `after_setup_theme` hook
* to make the functions pluggable
* (can be overridden from theme or other plugin)
*/
function flex_posts_after_setup_theme() {
require FLEX_POSTS_DIR . 'includes/template-tags.php';
}
add_action( 'after_setup_theme', 'flex_posts_after_setup_theme' );
/**
* Include block
*/
if ( function_exists( 'register_block_type' ) ) {
require FLEX_POSTS_DIR . 'blocks/list/block.php';
}
/**
* Register custom widget
*/
function flex_posts_register_widgets() {
register_widget( 'Flex_Posts_List' );
}
add_action( 'widgets_init', 'flex_posts_register_widgets' );
/**
* Load the text domain for translation.
*/
function flex_posts_load_textdomain() {
load_plugin_textdomain(
'flex-posts',
false,
dirname( plugin_basename( __FILE__ ) ) . '/languages'
);
}
add_action( 'plugins_loaded', 'flex_posts_load_textdomain' );
/**
* Register a new image size
*/
function flex_posts_init() {
add_image_size( '400x250-crop', 400, 250, true );
}
add_action( 'init', 'flex_posts_init' );