| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Plugin Name: Post Layouts |
| 5 |
* Plugin URI: https://wordpress.org/plugins/post-layouts/ |
| 6 |
* Description: Responsive post layout block with grid, list, and template-style post displays. |
| 7 |
* Author: Techeshta |
| 8 |
* Author URI: https://www.techeshta.com |
| 9 |
* Version: 2.0.1 |
| 10 |
* Requires at least: 5.0 |
| 11 |
* Tested up to: 7.1 |
| 12 |
* Requires PHP: 5.6 |
| 13 |
* License: GPL2+ |
| 14 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 15 |
* Text Domain: post-layouts |
| 16 |
* Domain Path: /src/languages |
| 17 |
*/ |
| 18 |
/** |
| 19 |
* Exit if accessed directly |
| 20 |
*/ |
| 21 |
|
| 22 |
if (!defined('ABSPATH')) { |
| 23 |
exit; |
| 24 |
} |
| 25 |
|
| 26 |
define('POST_LAYOUTS_DOMAIN', 'post-layouts'); |
| 27 |
define('POST_LAYOUTS_DIR', plugin_dir_path(__FILE__)); |
| 28 |
define('POST_LAYOUTS_URL', plugins_url('/', __FILE__)); |
| 29 |
define('POST_LAYOUTS_VERSION', '2.0.1'); |
| 30 |
|
| 31 |
/** |
| 32 |
* Initialize the blocks |
| 33 |
*/ |
| 34 |
function post_layouts_gutenberg_loader() { |
| 35 |
/** |
| 36 |
* Load the blocks functionality |
| 37 |
*/ |
| 38 |
require_once ( POST_LAYOUTS_DIR . 'dist/init.php'); |
| 39 |
|
| 40 |
/** |
| 41 |
* Load Post Grid PHP |
| 42 |
*/ |
| 43 |
require_once ( POST_LAYOUTS_DIR . 'src/blocks/index.php'); |
| 44 |
} |
| 45 |
|
| 46 |
// Hooked to 'init' (rather than 'plugins_loaded') so that translatable strings used |
| 47 |
// during block registration aren't loaded before WordPress is ready for them, which |
| 48 |
// triggers a "_load_textdomain_just_in_time" doing_it_wrong notice as of WP 6.7+. |
| 49 |
add_action('init', 'post_layouts_gutenberg_loader', 1); |
| 50 |
|
| 51 |
/** |
| 52 |
* Load the plugin text-domain |
| 53 |
*/ |
| 54 |
// WordPress 4.6+ automatically loads translations for plugin slugs on WordPress.org. |
| 55 |
// No manual load_plugin_textdomain() call is needed for this plugin. |
| 56 |
|
| 57 |
/** |
| 58 |
* Add a check for our plugin before redirecting |
| 59 |
*/ |
| 60 |
function post_layouts_gutenberg_activate() { |
| 61 |
add_option('post_layouts_gutenberg_do_activation_redirect', true); |
| 62 |
} |
| 63 |
|
| 64 |
register_activation_hook(__FILE__, 'post_layouts_gutenberg_activate'); |
| 65 |
|
| 66 |
/** |
| 67 |
* Add image sizes |
| 68 |
*/ |
| 69 |
function post_layouts_gutenberg_image_sizes() { |
| 70 |
// Post Grid Block |
| 71 |
add_image_size('pl-blogpost-landscape', 600, 400, true); |
| 72 |
add_image_size('pl-blogpost-square', 600, 600, true); |
| 73 |
} |
| 74 |
|
| 75 |
add_action('after_setup_theme', 'post_layouts_gutenberg_image_sizes'); |
| 76 |
|