| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Classic Blog Grid |
| 4 |
* Plugin URI: https://www.theclassictemplates.com/products/classic-blog-grid-pro |
| 5 |
* Description: A plugin to display blog posts in various grid formats: list, masonry, and slider. |
| 6 |
* Version: 2.2 |
| 7 |
* Requires at least: 5.2 |
| 8 |
* Requires PHP: 7.4 |
| 9 |
* Author: classictemplate |
| 10 |
* Author URI: https://www.theclassictemplates.com |
| 11 |
* License: GPL v2 or later |
| 12 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 13 |
* Text Domain: classic-blog-grid |
| 14 |
*/ |
| 15 |
|
| 16 |
if (!defined('ABSPATH')) { |
| 17 |
exit; |
| 18 |
} |
| 19 |
|
| 20 |
define('CLBGD_PLUGIN_VERSION', '2.2'); |
| 21 |
|
| 22 |
define('CLBGD_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
| 23 |
define('CLBGD_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 24 |
define('CLBGD_API_URL', 'https://license.theclassictemplates.com/api/public/'); |
| 25 |
define('CLBGD_SERVER_URL', 'https://www.theclassictemplates.com/'); |
| 26 |
|
| 27 |
require_once CLBGD_PLUGIN_DIR . 'global-functions.php'; |
| 28 |
require_once CLBGD_PLUGIN_DIR . 'includes/class-classic-blog-grid-core.php'; |
| 29 |
|
| 30 |
function clbgd_init() |
| 31 |
{ |
| 32 |
$clbgd_instance = Clbgd_Core::instance(); |
| 33 |
$clbgd_instance->init(); |
| 34 |
} |
| 35 |
add_action('plugins_loaded', 'clbgd_init'); |
| 36 |
|
| 37 |
//new added for fontawsome |
| 38 |
function clbgd_detect_shortcode($posts) |
| 39 |
{ |
| 40 |
if (empty($posts)) { |
| 41 |
return $posts; |
| 42 |
} |
| 43 |
|
| 44 |
$found = false; |
| 45 |
|
| 46 |
foreach ($posts as $post) { |
| 47 |
if (has_shortcode($post->post_content, 'clbgd')) { |
| 48 |
$found = true; |
| 49 |
break; |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
if ($found) { |
| 54 |
add_action('wp_enqueue_scripts', 'clbgd_enqueue_swiper_assets'); |
| 55 |
} |
| 56 |
|
| 57 |
return $posts; |
| 58 |
} |
| 59 |
add_filter('the_posts', 'clbgd_detect_shortcode'); |
| 60 |
|
| 61 |
function clbgd_enqueue_swiper_assets() |
| 62 |
{ |
| 63 |
wp_enqueue_style( |
| 64 |
'swiper-css', |
| 65 |
CLBGD_PLUGIN_URL . 'assets/lib/css/swiper-bundle.min.css', |
| 66 |
array(), |
| 67 |
CLBGD_PLUGIN_VERSION |
| 68 |
); |
| 69 |
|
| 70 |
wp_enqueue_script( |
| 71 |
'swiper-js', |
| 72 |
CLBGD_PLUGIN_URL . 'assets/lib/js/swiper-bundle.min.js', |
| 73 |
array('jquery'), |
| 74 |
CLBGD_PLUGIN_VERSION, |
| 75 |
true |
| 76 |
); |
| 77 |
|
| 78 |
wp_enqueue_style('classic-blog-boot-css', CLBGD_PLUGIN_URL . 'assets/css/bootstrap.min.css', [], CLBGD_PLUGIN_VERSION); |
| 79 |
wp_enqueue_script('classic-blog-boot-css-js', CLBGD_PLUGIN_URL . 'assets/js/bootstrap.bundle.min.js', ['jquery'], CLBGD_PLUGIN_VERSION, true); |
| 80 |
|
| 81 |
wp_enqueue_style('font-awesome', CLBGD_PLUGIN_URL . 'assets/lib/css/fontawesome-all.min.css', array(), CLBGD_PLUGIN_VERSION); |
| 82 |
|
| 83 |
} |
| 84 |
|