| 1 |
<?php |
| 2 |
/* |
| 3 |
* Plugin Name: Shapely Companion |
| 4 |
* Plugin URI: https://colorlib.com/wp/themes/shapely/ |
| 5 |
* Description: Shapely Companion is a companion plugin for Shapely theme. |
| 6 |
* Version: 1.2.13 |
| 7 |
* Requires at least: 6.4 |
| 8 |
* Tested up to: 7.0 |
| 9 |
* Requires PHP: 7.4 |
| 10 |
* Author: Colorlib |
| 11 |
* Author URI: https://colorlib.com |
| 12 |
* License: GPL-2.0+ |
| 13 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt |
| 14 |
* Text Domain: shapely-companion |
| 15 |
* Domain Path: /languages |
| 16 |
*/ |
| 17 |
|
| 18 |
if ( ! defined( 'WPINC' ) ) { |
| 19 |
die; |
| 20 |
} |
| 21 |
|
| 22 |
define( 'SHAPELY_COMPANION', '1.2.10' ); |
| 23 |
|
| 24 |
/** |
| 25 |
* Initialize widgets and theme compatibility check. |
| 26 |
*/ |
| 27 |
function shapely_companion_setup() { |
| 28 |
$current_theme = wp_get_theme(); |
| 29 |
$current_parent = $current_theme->parent(); |
| 30 |
|
| 31 |
if ( 'Shapely' == $current_theme->get( 'Name' ) || ( $current_parent && 'Shapely' == $current_parent->get( 'Name' ) ) ) { |
| 32 |
/** |
| 33 |
* Load the Widgets |
| 34 |
*/ |
| 35 |
require_once plugin_dir_path( __FILE__ ) . 'inc/shapely-widgets.php'; |
| 36 |
} |
| 37 |
} |
| 38 |
add_action( 'after_setup_theme', 'shapely_companion_setup' ); |
| 39 |
|
| 40 |
/** |
| 41 |
* Initialize the plugin logic. |
| 42 |
*/ |
| 43 |
function shapely_companion_init() { |
| 44 |
/** |
| 45 |
* Load the Dashboard Widget |
| 46 |
*/ |
| 47 |
require_once plugin_dir_path( __FILE__ ) . 'inc/epsilon-dashboard/class-epsilon-dashboard.php'; |
| 48 |
|
| 49 |
/** |
| 50 |
* The helper method to run the class |
| 51 |
* |
| 52 |
* @return Epsilon_Dashboard |
| 53 |
*/ |
| 54 |
function shapely_companion_dashboard_widget() { |
| 55 |
$epsilon_dashboard_args = array( |
| 56 |
'widget_title' => esc_html__( 'From our blog', 'shapely-companion' ), |
| 57 |
'feed_url' => array( 'https://colorlib.com/wp/feed/' ), |
| 58 |
); |
| 59 |
return Epsilon_Dashboard::instance( $epsilon_dashboard_args ); |
| 60 |
} |
| 61 |
|
| 62 |
/** |
| 63 |
* Setup the dashboard widget. |
| 64 |
*/ |
| 65 |
function shapely_companion_setup_dashboard_widget() { |
| 66 |
shapely_companion_dashboard_widget(); |
| 67 |
} |
| 68 |
add_action( 'wp_dashboard_setup', 'shapely_companion_setup_dashboard_widget' ); |
| 69 |
|
| 70 |
$current_theme = wp_get_theme(); |
| 71 |
$current_parent = $current_theme->parent(); |
| 72 |
|
| 73 |
if ( 'Shapely' == $current_theme->get( 'Name' ) || ( $current_parent && 'Shapely' == $current_parent->get( 'Name' ) ) ) { |
| 74 |
/** |
| 75 |
* Load Enqueues |
| 76 |
*/ |
| 77 |
require_once plugin_dir_path( __FILE__ ) . '/inc/shapely-enqueues.php'; |
| 78 |
|
| 79 |
/** |
| 80 |
* Load Helper |
| 81 |
*/ |
| 82 |
require_once plugin_dir_path( __FILE__ ) . '/inc/shapely-helper.php'; |
| 83 |
|
| 84 |
/** |
| 85 |
* Load Import Demo Content Functionality |
| 86 |
*/ |
| 87 |
require_once plugin_dir_path( __FILE__ ) . '/inc/shapely-demo-content.php'; |
| 88 |
|
| 89 |
/** |
| 90 |
* Load Nav Menu Functionality |
| 91 |
*/ |
| 92 |
require_once plugin_dir_path( __FILE__ ) . '/inc/shapely-navmenu.php'; |
| 93 |
|
| 94 |
/** |
| 95 |
* Load Metabox for Portfolio |
| 96 |
*/ |
| 97 |
if ( class_exists( 'Jetpack' ) && Jetpack::is_module_active( 'custom-content-types' ) ) { |
| 98 |
$jetpack_portfolio = get_option( 'jetpack_portfolio' ); |
| 99 |
if ( $jetpack_portfolio ) { |
| 100 |
require_once plugin_dir_path( __FILE__ ) . '/inc/shapely-metabox.php'; |
| 101 |
} |
| 102 |
} |
| 103 |
} else { |
| 104 |
add_action( 'admin_notices', 'shapely_companion_admin_notice', 99 ); |
| 105 |
function shapely_companion_admin_notice() { |
| 106 |
?> |
| 107 |
<div class="notice-warning notice"> |
| 108 |
<p><?php printf( wp_kses_post( __( 'In order to use the <strong>Shapely Companion</strong> plugin you have to also install the %1$sShapely Theme%2$s', 'shapely-companion' ) ), '<a href="https://wordpress.org/themes/shapely/" target="_blank">', '</a>' ); ?></p> |
| 109 |
</div> |
| 110 |
<?php |
| 111 |
} |
| 112 |
} |
| 113 |
} |
| 114 |
add_action( 'init', 'shapely_companion_init' ); |
| 115 |
|
| 116 |
|
| 117 |
|