| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Virtue/Ascend/Pinnacle Toolkit |
| 4 |
* Description: Custom Portfolio and Shortcode functionality for free Virtue, Ascend, and Pinnacle WordPress themes. |
| 5 |
* Version: 4.9.12.2 |
| 6 |
* Author: Kadence WP |
| 7 |
* Author URI: https://kadencewp.com/ |
| 8 |
* License: GPLv2 or later |
| 9 |
* |
| 10 |
* @package Kadence Toolkit |
| 11 |
*/ |
| 12 |
|
| 13 |
/** |
| 14 |
* Kadence Toolkit Activation |
| 15 |
*/ |
| 16 |
function virtue_toolkit_activation() { |
| 17 |
flush_rewrite_rules(); |
| 18 |
get_option( 'kadence_toolkit_flushpermalinks', '2' ); |
| 19 |
} |
| 20 |
register_activation_hook( __FILE__, 'virtue_toolkit_activation' ); |
| 21 |
|
| 22 |
/** |
| 23 |
* Set redux args |
| 24 |
* |
| 25 |
* @param array $args redux framework args. |
| 26 |
*/ |
| 27 |
function virtue_toolkit_redux_args_new( $args ) { |
| 28 |
$args['customizer_only'] = false; |
| 29 |
$args['save_defaults'] = true; |
| 30 |
return $args; |
| 31 |
} |
| 32 |
add_filter( 'kadence_theme_options_args', 'virtue_toolkit_redux_args_new' ); |
| 33 |
|
| 34 |
if ( ! defined( 'VIRTUE_TOOLKIT_PATH' ) ) { |
| 35 |
define( 'VIRTUE_TOOLKIT_PATH', realpath( plugin_dir_path( __FILE__ ) ) . DIRECTORY_SEPARATOR ); |
| 36 |
} |
| 37 |
if ( ! defined( 'VIRTUE_TOOLKIT_URL' ) ) { |
| 38 |
define( 'VIRTUE_TOOLKIT_URL', plugin_dir_url( __FILE__ ) ); |
| 39 |
} |
| 40 |
|
| 41 |
require_once VIRTUE_TOOLKIT_PATH . 'kadence_image_processing.php'; |
| 42 |
require_once VIRTUE_TOOLKIT_PATH . 'post-types.php'; |
| 43 |
require_once VIRTUE_TOOLKIT_PATH . 'gallery.php'; |
| 44 |
require_once VIRTUE_TOOLKIT_PATH . 'author_box.php'; |
| 45 |
require_once VIRTUE_TOOLKIT_PATH . 'shortcodes.php'; |
| 46 |
require_once VIRTUE_TOOLKIT_PATH . 'shortcode_ajax.php'; |
| 47 |
require_once VIRTUE_TOOLKIT_PATH . 'pagetemplater.php'; |
| 48 |
require_once VIRTUE_TOOLKIT_PATH . 'metaboxes.php'; |
| 49 |
require_once VIRTUE_TOOLKIT_PATH . 'class-virtue-toolkit-welcome.php'; |
| 50 |
require_once VIRTUE_TOOLKIT_PATH . 'widgets.php'; |
| 51 |
|
| 52 |
/** |
| 53 |
* Virtue Toolkit Textdomain |
| 54 |
*/ |
| 55 |
function virtue_toolkit_textdomain() { |
| 56 |
load_plugin_textdomain( 'virtue-toolkit', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
| 57 |
} |
| 58 |
add_action( 'plugins_loaded', 'virtue_toolkit_textdomain' ); |
| 59 |
|
| 60 |
|
| 61 |
function virtue_toolkit_admin_scripts( $hook ) { |
| 62 |
wp_enqueue_style( 'virtue_toolkit_adminstyles', VIRTUE_TOOLKIT_URL . '/assets/toolkit_admin.css', false, 46 ); |
| 63 |
|
| 64 |
if( $hook != 'edit.php' && $hook != 'post.php' && $hook != 'post-new.php' && $hook != 'widgets.php' ) { |
| 65 |
return; |
| 66 |
} |
| 67 |
wp_enqueue_media(); |
| 68 |
wp_enqueue_script('toolkit_gallery_meta', VIRTUE_TOOLKIT_URL . '/assets/kttk_admin_gallery.js', array( 'jquery' ), 460, false); |
| 69 |
|
| 70 |
} |
| 71 |
|
| 72 |
add_action('admin_enqueue_scripts', 'virtue_toolkit_admin_scripts'); |
| 73 |
|
| 74 |
function virtue_toolkit_flushpermalinks() { |
| 75 |
$hasflushed = get_option('kadence_toolkit_flushpermalinks', '0'); |
| 76 |
if($hasflushed != '2') { |
| 77 |
flush_rewrite_rules(); |
| 78 |
update_option('kadence_toolkit_flushpermalinks', '2'); |
| 79 |
} |
| 80 |
} |
| 81 |
add_action('init', 'virtue_toolkit_flushpermalinks'); |
| 82 |
|
| 83 |
|
| 84 |
add_action( 'after_setup_theme', 'virtue_toolkit_add_in_slider_sections', 1); |
| 85 |
function virtue_toolkit_add_in_slider_sections() { |
| 86 |
$the_theme = wp_get_theme(); |
| 87 |
// Ascend only |
| 88 |
if( $the_theme->get( 'Name' ) == 'Ascend' || $the_theme->get( 'Template') == 'ascend' ) { |
| 89 |
|
| 90 |
if ( ! class_exists( 'Redux' ) ) { |
| 91 |
return; |
| 92 |
} |
| 93 |
if(ReduxFramework::$_version <= '3.5.6') { |
| 94 |
return; |
| 95 |
} |
| 96 |
|
| 97 |
$options_slug = 'ascend'; |
| 98 |
$home_header = Redux::getField($options_slug, 'home_header'); |
| 99 |
if(is_array($home_header)){ |
| 100 |
$hextras = array('basic' => __('Basic Slider', 'ascend'), 'basic_post_carousel' => __('Post Carousel', 'ascend')); |
| 101 |
$home_header['options'] = array_merge($hextras, $home_header['options']); |
| 102 |
} |
| 103 |
Redux::setField($options_slug, $home_header); |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|