PluginProbe
Flex Posts – Responsive Posts Block / 2.1.0
Flex Posts – Responsive Posts Block v2.1.0
2.1.0 trunk 1.12.0 2.0.0
flex-posts / flex-posts.php

flex-posts.php in Flex Posts – Responsive Posts Block 2.1.0, at flex-posts.php

107 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Flex Posts - Responsive Posts Block
4 * Plugin URI: https://tajam.id/flex-posts/
5 * Description: Show your posts with thumbnails in flexible, responsive layouts. Works as a sidebar widget or a block in the editor.
6 * Version: 2.1.0
7 * Author: Tajam
8 * Author URI: https://tajam.id/
9 * License: GPL-2.0+
10 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
11 * Text Domain: flex-posts
12 * Domain Path: /languages
13 *
14 * Flex Posts is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 2 of the License, or
17 * any later version.
18 *
19 * Flex Posts is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with Flex Posts. If not, see http://www.gnu.org/licenses/gpl-2.0.txt
26 *
27 * @package Flex Posts
28 */
29
30 if ( ! defined( 'ABSPATH' ) ) {
31 exit;
32 }
33
34 /**
35 * Current plugin version.
36 */
37 define( 'FLEX_POSTS_VERSION', '2.1.0' );
38
39 /**
40 * Plugin directory and url
41 */
42 define( 'FLEX_POSTS_DIR', plugin_dir_path( __FILE__ ) );
43 define( 'FLEX_POSTS_URL', plugin_dir_url( __FILE__ ) );
44
45 /**
46 * Include functions & widget classes
47 */
48 require FLEX_POSTS_DIR . 'includes/render.php';
49 require FLEX_POSTS_DIR . 'includes/pagination.php';
50 require FLEX_POSTS_DIR . 'includes/data.php';
51 require FLEX_POSTS_DIR . 'includes/form-helpers.php';
52 require FLEX_POSTS_DIR . 'includes/category.php';
53 require FLEX_POSTS_DIR . 'includes/class-flex-posts-widget.php';
54 require FLEX_POSTS_DIR . 'includes/class-flex-posts-list.php';
55 if ( is_admin() ) {
56 require FLEX_POSTS_DIR . 'includes/class-options.php';
57 }
58
59 /**
60 * Include template functions in `after_setup_theme` hook
61 * to make the functions pluggable
62 * (can be overridden from theme or other plugin)
63 */
64 function flex_posts_after_setup_theme() {
65 require FLEX_POSTS_DIR . 'includes/template-tags.php';
66 }
67 add_action( 'after_setup_theme', 'flex_posts_after_setup_theme' );
68
69 /**
70 * Include block
71 */
72 if ( function_exists( 'register_block_type' ) ) {
73 require FLEX_POSTS_DIR . 'blocks/list/block.php';
74 }
75
76 /**
77 * Register custom widget
78 */
79 function flex_posts_register_widgets() {
80 register_widget( 'Flex_Posts_List' );
81 }
82 add_action( 'widgets_init', 'flex_posts_register_widgets' );
83
84 /**
85 * Initialize plugin
86 */
87 function flex_posts_init() {
88 $option = get_option( 'flex_posts' );
89 if ( empty( $option['disable_image_size'] ) ) {
90 add_image_size( '400x250-crop', 400, 250, true );
91 }
92 }
93 add_action( 'init', 'flex_posts_init' );
94
95 /**
96 * Add settings link
97 *
98 * @param array $actions Actions.
99 * @return array
100 */
101 function flex_posts_action_links( $actions ) {
102 $links[] = '<a href="' . esc_url( admin_url( 'options-general.php?page=flex-posts' ) ) . '">' . esc_html__( 'Settings', 'flex-posts' ) . '</a>';
103 $actions = array_merge( $links, $actions );
104 return $actions;
105 }
106 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'flex_posts_action_links' );
107