tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
//Register Menus
$locations = array(
'top_navigation' => __( 'Top Navigation ', 'cpmmagz' ),
'primary_navigation' => __( 'Primary Navigation', 'cpmmagz' ),
'footer_navigation' => __( 'Footer Navigation', 'cpmmagz' ),
);
register_nav_menus( $locations );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
/*
* Enable support for Post Formats.
* See http://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', array(
'aside',
'image',
'video',
'quote',
'link',
'gallery'
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'cpmmagz_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
//Site logo
$args = array(
'header-text' => array(
'site-title',
'site-description',
),
'size' => 'medium',
);
add_theme_support( 'site-logo', $args );
}
endif; // cpmmagz_setup
add_action( 'after_setup_theme', 'cpmmagz_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
if ( ! function_exists( 'cpmmagz_content_width' ) ) :
function cpmmagz_content_width() {
$GLOBALS['content_width'] = apply_filters( 'cpmmagz_content_width', 640 );
}
add_action( 'after_setup_theme', 'cpmmagz_content_width', 0 );
endif;
/**
* Register widget area.
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
if ( function_exists('register_sidebar') ) {
function cpmmagz_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'cpmmagz' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Pre Footer-1', 'cpmmagz' ),
'id' => 'pre-footer1',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Pre Footer-2', 'cpmmagz' ),
'id' => 'pre-footer2',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Pre Footer-3', 'cpmmagz' ),
'id' => 'pre-footer3',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Pre Footer-4', 'cpmmagz' ),
'id' => 'pre-footer4',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'cpmmagz_widgets_init' );
}
if (! function_exists('cpmmagz_add_editor_styles') ) {
function cpmmagz_add_editor_styles() {
add_editor_style( 'css/editor-style.css' );
}
add_action( 'admin_init', 'cpmmagz_add_editor_styles' );
}
if (! function_exists('cpmmagz_theme_color') ) {
function cpmmagz_theme_color(){
$color = get_theme_mod('theme-color');
if( $color == 'green'){
wp_enqueue_style('cpmagz-colors-green');
}
if( $color == 'red'){
wp_enqueue_style('cpmagz-colors-red');
}
if( $color == 'blue'){
wp_enqueue_style('cpmagz-colors-blue');
}
if( $color == 'turquoise'){
wp_enqueue_style('cpmagz-colors-turquoise');
}
if( $color == 'purple'){
wp_enqueue_style('cpmagz-colors-purple');
}
if( $color == 'aspalt'){
wp_enqueue_style('cpmagz-colors-aspalt');
}
}
}
/**
* Enqueue scripts and styles.
*/
if (! function_exists('cpmmagz_scripts') ) {
function cpmmagz_scripts() {
wp_enqueue_style( 'cpmmagz-style', get_template_directory_uri().'/style.css' );
wp_enqueue_style( 'cssmenu', get_template_directory_uri().'/lab/cssmenu/styles.css' );
// wp_enqueue_style( 'cpmagz-mmenu', get_template_directory_uri() . '/css/jquery.mmenu.all.css');
wp_enqueue_script( 'jquery-min', get_template_directory_uri(). '/js/vendor/jquery-1.11.2.min.js' );
wp_enqueue_script( 'vendor-js', get_template_directory_uri(). '/js/vendor/vendor.js',array(), '1.0.0',true );
wp_register_style( 'cpmagz-colors-red', get_template_directory_uri() . '/css/red.css');
wp_register_style( 'cpmagz-colors-green', get_template_directory_uri() . '/css/green.css');
wp_register_style( 'cpmagz-colors-blue', get_template_directory_uri() . '/css/blue.css');
wp_register_style( 'cpmagz-colors-purple', get_template_directory_uri() . '/css/purple.css');
wp_register_style( 'cpmagz-colors-turquoise', get_template_directory_uri() . '/css/turquoise.css');
wp_register_style( 'cpmagz-colors-aspalt', get_template_directory_uri() . '/css/aspalt.css');
cpmmagz_theme_color();
wp_enqueue_script( 'cpmmagz-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
wp_enqueue_script( 'cpmmagz-app-js', get_template_directory_uri() . '/js/app.js', array(), '20150820', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'cpmmagz_scripts' );
}
/**
* Implement the Custom Header feature.
*/
//require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
//require_once('lab','nav_walker');
/**
* This file represents an example of the code that themes would use to register
* the required plugins.
*
* It is expected that theme authors would copy and paste this code into their
* functions.php file, and amend to suit.
*
* @see http://tgmpluginactivation.com/configuration/ for detailed documentation.
*
* @package TGM-Plugin-Activation
* @subpackage Example
* @version 2.5.2
* @author Thomas Griffin, Gary Jones, Juliette Reinders Folmer
* @copyright Copyright (c) 2011, Thomas Griffin
* @license http://opensource.org/licenses/gpl-2.0.php GPL v2 or later
* @link https://github.com/TGMPA/TGM-Plugin-Activation
*/
/**
* Include the TGM_Plugin_Activation class.
*/
require_once dirname( __FILE__ ) . '/class-tgm-plugin-activation.php';
add_action( 'tgmpa_register', 'cpmmagz_theme_register_required_plugins' );
/**
* Register the required plugins for this theme.
*
* In this example, we register five plugins:
* - one included with the TGMPA library
* - two from an external source, one from an arbitrary source, one from a GitHub repository
* - two from the .org repo, where one demonstrates the use of the `is_callable` argument
*
* The variable passed to tgmpa_register_plugins() should be an array of plugin
* arrays.
*
* This function is hooked into tgmpa_init, which is fired within the
* TGM_Plugin_Activation class constructor.
*/
function cpmmagz_theme_register_required_plugins() {
/*
* Array of plugin arrays. Required keys are name and slug.
* If the source is NOT from the .org repo, then source is also required.
*/
$plugins = array(
// This is an example of how to include a plugin from the WordPress Plugin Repository.
array(
'name' => 'Jetpack',
'slug' => 'jetpack',
'required' => true,
),
array(
'name' => 'Advanced Custom Fields',
'slug' => 'advanced-custom-fields',
'required' => false,
),
array(
'name' => 'MailChimp For WordPress Lite',
'slug' => 'mailchimp-for-wp',
'required' => true,
),
// This is an example of the use of 'is_callable' functionality. A user could - for instance -
// have WPSEO installed *or* WPSEO Premium. The slug would in that last case be different, i.e.
// 'wordpress-seo-premium'.
// By setting 'is_callable' to either a function from that plugin or a class method
// `array( 'class', 'method' )` similar to how you hook in to actions and filters, TGMPA can still
// recognize the plugin as being installed.
array(
'name' => 'WordPress SEO by Yoast',
'slug' => 'wordpress-seo',
'is_callable' => 'wpseo_init',
),
);
/*
* Array of configuration settings. Amend each line as needed.
*
* TGMPA will start providing localized text strings soon. If you already have translations of our standard
* strings available, please help us make TGMPA even better by giving us access to these translations or by
* sending in a pull-request with .po file(s) with the translations.
*
* Only uncomment the strings in the config array if you want to customize the strings.
*/
$config = array(
'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'parent_slug' => 'themes.php', // Parent menu slug.
'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used.
'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '' // Message to output right before the plugins table.
/*
'strings' => array(
'page_title' => __( 'Install Required Plugins', 'theme-slug' ),
'menu_title' => __( 'Install Plugins', 'theme-slug' ),
'installing' => __( 'Installing Plugin: %s', 'theme-slug' ), // %s = plugin name.
'oops' => __( 'Something went wrong with the plugin API.', 'theme-slug' ),
'notice_can_install_required' => _n_noop(
'This theme requires the following plugin: %1$s.',
'This theme requires the following plugins: %1$s.',
'theme-slug'
), // %1$s = plugin name(s).
'notice_can_install_recommended' => _n_noop(
'This theme recommends the following plugin: %1$s.',
'This theme recommends the following plugins: %1$s.',
'theme-slug'
), // %1$s = plugin name(s).
'notice_cannot_install' => _n_noop(
'Sorry, but you do not have the correct permissions to install the %1$s plugin.',
'Sorry, but you do not have the correct permissions to install the %1$s plugins.',
'theme-slug'
), // %1$s = plugin name(s).
'notice_ask_to_update' => _n_noop(
'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.',
'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.',
'theme-slug'
), // %1$s = plugin name(s).
'notice_ask_to_update_maybe' => _n_noop(
'There is an update available for: %1$s.',
'There are updates available for the following plugins: %1$s.',
'theme-slug'
), // %1$s = plugin name(s).
'notice_cannot_update' => _n_noop(
'Sorry, but you do not have the correct permissions to update the %1$s plugin.',
'Sorry, but you do not have the correct permissions to update the %1$s plugins.',
'theme-slug'
), // %1$s = plugin name(s).
'notice_can_activate_required' => _n_noop(
'The following required plugin is currently inactive: %1$s.',
'The following required plugins are currently inactive: %1$s.',
'theme-slug'
), // %1$s = plugin name(s).
'notice_can_activate_recommended' => _n_noop(
'The following recommended plugin is currently inactive: %1$s.',
'The following recommended plugins are currently inactive: %1$s.',
'theme-slug'
), // %1$s = plugin name(s).
'notice_cannot_activate' => _n_noop(
'Sorry, but you do not have the correct permissions to activate the %1$s plugin.',
'Sorry, but you do not have the correct permissions to activate the %1$s plugins.',
'theme-slug'
), // %1$s = plugin name(s).
'install_link' => _n_noop(
'Begin installing plugin',
'Begin installing plugins',
'theme-slug'
),
'update_link' => _n_noop(
'Begin updating plugin',
'Begin updating plugins',
'theme-slug'
),
'activate_link' => _n_noop(
'Begin activating plugin',
'Begin activating plugins',
'theme-slug'
),
'return' => __( 'Return to Required Plugins Installer', 'theme-slug' ),
'plugin_activated' => __( 'Plugin activated successfully.', 'theme-slug' ),
'activated_successfully' => __( 'The following plugin was activated successfully:', 'theme-slug' ),
'plugin_already_active' => __( 'No action taken. Plugin %1$s was already active.', 'theme-slug' ), // %1$s = plugin name(s).
'plugin_needs_higher_version' => __( 'Plugin not activated. A higher version of %s is needed for this theme. Please update the plugin.', 'theme-slug' ), // %1$s = plugin name(s).
'complete' => __( 'All plugins installed and activated successfully. %1$s', 'theme-slug' ), // %s = dashboard link.
'contact_admin' => __( 'Please contact the administrator of this site for help.', 'tgmpa' ),
'nag_type' => 'updated', // Determines admin notice type - can only be 'updated', 'update-nag' or 'error'.
),
*/
);
tgmpa( $plugins, $config );
}
require get_template_directory() . '/functions-extra.php';
require get_template_directory() . '/post-widget.php';