Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.11 KB | None | 0 0
  1. // VC blocks load
  2.  
  3. <?php
  4.  
  5. if ( !defined('ABSPATH')) die('-1');
  6.  
  7. // Class started
  8.  
  9. class stockVCExtendAddonClass{
  10.  
  11.     function __construct() {
  12.         //we safely integrate with VC with this hook
  13.         add_action( 'init', array($this, 'stockIntegrateWithVC') );
  14.     }
  15.  
  16.     public function stockIntegrateWithVC() {
  17.         // Check if Visual Composer is not installed
  18.         if ( ! defined ( 'WPB_VC_VERSION') ){
  19.             add_action('admin_notices', array($this, 'stockShowVcVersionNotice'));
  20.             return;
  21.         }
  22.  
  23.         // visual composer addons
  24.         include STOCK_ACC_PATH. '/vc-addons/vc-pagelist.php';
  25.  
  26.     }
  27.  
  28.     //show visual composer version
  29.     public function stockShowVcVersionNotice() {
  30.         $theme_data = wp_get_theme();
  31.         echo'
  32.         <div class="notice notice-warning">
  33.          <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.', 'stock-crazycafe'), $theme_data->get('Name')).'</p>
  34.        </div>';
  35.     }
  36.  
  37. }
  38.  
  39. // Finally initialize code
  40.  
  41. new stockVCExtendAddonClass();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement