File: /home/sarlight.ru/public_html/wp-content/plugins/addison/addison.php
<?php
/**
* Plugin Name: Addison Plugin
* Description: Shortcodes and widgets by BoldThemes.
* Version: 1.0.4
* Author: BoldThemes
* Author URI: http://bold-themes.com
*/
require_once( 'framework_bt_plugin/framework.php' );
global $bt_plugin_dir;
$bt_plugin_dir = plugin_dir_path( __FILE__ );
function bt_load_custom_wp_admin_style() {
wp_enqueue_style( 'bt_custom_wp_admin_css', plugin_dir_url( __FILE__ ) . 'admin-style.css' );
}
add_action( 'admin_enqueue_scripts', 'bt_load_custom_wp_admin_style' );
function bt_load_plugin_textdomain() {
$domain = 'bt_plugin';
$locale = apply_filters( 'plugin_locale', get_locale(), $domain );
load_plugin_textdomain( $domain, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
}
add_action( 'plugins_loaded', 'bt_load_plugin_textdomain' );
function bt_widget_areas() {
register_sidebar( array (
'name' => esc_html__( 'Header Left Widgets', 'bt_plugin' ),
'id' => 'header_left_widgets',
'before_widget' => '<div class="btTopBox %2$s">',
'after_widget' => '</div>'
));
register_sidebar( array (
'name' => esc_html__( 'Header Right Widgets', 'bt_plugin' ),
'id' => 'header_right_widgets',
'before_widget' => '<div class="btTopBox %2$s">',
'after_widget' => '</div>'
));
register_sidebar( array (
'name' => esc_html__( 'Header Menu Widgets', 'bt_plugin' ),
'id' => 'header_menu_widgets',
'before_widget' => '<div class="btTopBox %2$s">',
'after_widget' => '</div>'
));
register_sidebar( array (
'name' => esc_html__( 'Header Logo Widgets', 'bt_plugin' ),
'id' => 'header_logo_widgets',
'before_widget' => '<div class="btTopBox %2$s">',
'after_widget' => '</div>'
));
register_sidebar( array (
'name' => esc_html__( 'Footer Widgets', 'bt_plugin' ),
'id' => 'footer_widgets',
'before_widget' => '<div class="btBox %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4><span>',
'after_title' => '</span></h4>',
));
}
add_action( 'widgets_init', 'bt_widget_areas', 30 );
/* Portfolio */
if ( ! function_exists( 'bt_create_portfolio' ) ) {
function bt_create_portfolio() {
register_post_type( 'portfolio',
array(
'labels' => array(
'name' => __( 'Portfolio', 'bt_plugin' ),
'singular_name' => __( 'Portfolio Item', 'bt_plugin' )
),
'public' => true,
'has_archive' => true,
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'thumbnail', 'author', 'comments', 'excerpt' ),
'rewrite' => array( 'with_front' => false, 'slug' => 'portfolio' )
)
);
register_taxonomy( 'portfolio_category', 'portfolio', array( 'hierarchical' => true, 'label' => __( 'Portfolio Categories', 'bt_plugin' ) ) );
}
}
add_action( 'init', 'bt_create_portfolio' );
if ( ! function_exists( 'bt_rewrite_flush' ) ) {
function bt_rewrite_flush() {
// First, we "add" the custom post type via the above written function.
// Note: "add" is written with quotes, as CPTs don't get added to the DB,
// They are only referenced in the post_type column with a post entry,
// when you add a post of this CPT.
bt_create_portfolio();
// ATTENTION: This is *only* done during plugin activation hook in this example!
// You should *NEVER EVER* do this on every page load!!
flush_rewrite_rules();
}
}
register_activation_hook( __FILE__, 'bt_rewrite_flush' );