Class 10

[php]

<?php

/*
Plugin Name: Intern Shortcode
Plugin URI: http://totthoprojukti.com
Author: Md Hasan Fardous
Author URI: http://hasanfardous.me
Description: This is for practice purpose only.
Version: 1.0
*/
// Exit if access directly

if(! defined(‘ABSPATH’)){
exit;
}
// define
define( ‘SEO_ACC_URL’, WP_PLUGIN_URL . ‘/’ . plugin_basename ( dirname (__FILE__)) . ‘/’ );
define( ‘SEO_ACC_PATH’, plugin_dir_path (__FILE__) );
// print shortcodes in widget
add_filter(‘widget_text’, ‘do_shortcode’);
// loading vc-addons
require_once(SEO_ACC_PATH. ‘vc-addons/vc-blocks-load.php’);
// loading vc-addons
require_once(SEO_ACC_PATH. ‘vc-addons/vc-blocks-load.php’);

// theme shortcodes
require_once(SEO_ACC_PATH. ‘theme-shortcodes/slides-shortcode.php’);

// shortcodes depended on visual composer
include_once(ABSPATH . ‘wp-admin/includes/plugin.php’);
if(is_plugin_active(‘js_composer/js_composer.php’)){
require_once(SEO_ACC_PATH. ‘theme-shortcodes/staff-shortcode.php’);
}

// registering seo toolkit files
function seo_toolkit_files(){
wp_enqueue_style(‘owl-carousel’, plugin_dir_url(__FILE__) . ‘asset/css/owl.carousel.css’);
wp_enqueue_script(‘owl-carousel’, plugin_dir_url(__FILE__) . ‘asset/css/owl.carousel.min.js’, array(‘jquery’), 20120206, true);
}
add_action(‘wp_enqueue_scripts’, ‘seo_toolkit_files’);

&nbsp;

&nbsp;

//vc blocks load file

&nbsp;

if(!defined(‘ABSPATH’)) die(‘-1’);

//class started
class seoVCExtendAddonClass{
function __construct(){
//we safely ingrate with vc with this hook
add_action(‘init’, array($this, ‘seoIntegrateWithVC’));
}

public function seoIntegrateWithVC(){
//check if visual composer is not installed
if(! defined(‘WPB_VC_VERSION’)){
add_action(‘admin_notices’, array($this, ‘seoShowVCVersionNotice’));
return;
}

//visual composer addons
include SEO_ACC_PATH . ‘/vc-addons/vc-slides.php’;
}

//show visual composer version
public function seoShowVCVersionNotice(){
$theme_data = wp_get_theme();
echo ‘
<div class="notice notice-warning">
<p>’.sprintf(‘<strong>%s</strong> recommends <strong><a href="’.site_url().’/wp-admin/themes.php?page=tgmpa-install-plugins" target="_blank">Visual Composer</a></strong> plugin to be installed and activated on your site.’, $theme_data->get(‘Name’)).'</p>
</div>’;
}
}

//finally initialize code

new seoVCExtendAddonClass();

&nbsp;

?>

[/php]

Leave a Reply

Your email address will not be published. Required fields are marked *