__( 'Primary Menu', 'albinomouse' ),
) );
/**
* Enable support for Post Formats
*/
add_theme_support( 'post-formats', array( 'aside', 'chat', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio' ) );
}
endif; // albinomouse_setup
add_action( 'after_setup_theme', 'albinomouse_setup' );
/**
* Register widgetized area and update sidebar with default widgets
*/
function albinomouse_widgets_init() {
$options = get_option( 'albinomouse' );
register_sidebar( array(
'name' => __( 'Sidebar', 'albinomouse' ),
'id' => 'sidebar-1',
'before_widget' => '',
'before_title' => '
',
) );
if ($options['footer-layout']) {
register_sidebar( array(
'name' => __( 'Footer 1', 'albinomouse' ),
'id' => 'footer-1',
'before_widget' => '',
'before_title' => '',
) );
}
if ($options['footer-layout'] == '2col' || $options['footer-layout'] == '3col' || $options['footer-layout'] == '4col') {
register_sidebar( array(
'name' => __( 'Footer 2', 'albinomouse' ),
'id' => 'footer-2',
'before_widget' => '',
'before_title' => '',
) );
}
if ($options['footer-layout'] == '3col' || $options['footer-layout'] == '4col') {
register_sidebar( array(
'name' => __( 'Footer 3', 'albinomouse' ),
'id' => 'footer-3',
'before_widget' => '',
'before_title' => '',
) );
}
if ($options['footer-layout'] == '4col') {
register_sidebar( array(
'name' => __( 'Footer 4', 'albinomouse' ),
'id' => 'footer-4',
'before_widget' => '',
'before_title' => '',
) );
}
}
add_action( 'widgets_init', 'albinomouse_widgets_init' );
/**
* Enqueue scripts and styles
*/
function albinomouse_scripts() {
wp_enqueue_style( 'albinomouse-style', get_stylesheet_uri() );
wp_enqueue_script( 'bootstrap-scripts', get_template_directory_uri() . '/scripts.js', array('jquery'), '', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'albinomouse_scripts' );
/**
* Overwrite Jetpacks social sharing buttons
*/
$options = get_option( 'albinomouse' );
if(!isset($options['flat-social-btn']) or $options['flat-social-btn'] == '1') {
function overwrite_jetpack_social_buttons(){
wp_deregister_style('sharedaddy');
wp_enqueue_style( 'flat-social-buttons', get_template_directory_uri() . '/inc/flat-social-buttons/flat-social-buttons.css' );
}
add_action('wp_print_styles', 'overwrite_jetpack_social_buttons');
}
/**
* 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';
/**
* Register Custom Navigation Walker
*/
require get_template_directory() . '/inc/wp_bootstrap_navwalker.php';
/**
* Enqueue stylesheet for Google web fonts
* This function is attached to the wp_head action hook.
*/
function albinomouse_google_web_fonts() {
$options = get_option( 'albinomouse' );
if ($options['title_font'] == 'Anton') {
wp_enqueue_style( 'Anton', 'http://fonts.googleapis.com/css?family=Anton' );
}
if ($options['title_font'] == 'Bitter') {
wp_enqueue_style( 'Bitter', 'http://fonts.googleapis.com/css?family=Bitter' );
}
if ($options['title_font'] == 'Droid Sans' || $options['general_font'] == 'Droid Sans') {
wp_enqueue_style( 'DroidSans', 'http://fonts.googleapis.com/css?family=Droid+Sans:400,700' );
}
if ($options['title_font'] == 'Droid Serif' || $options['general_font'] == 'Droid Serif') {
wp_enqueue_style( 'DroidSerif', 'http://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic' );
}
if ($options['title_font'] == 'Open Sans' || $options['general_font'] == 'Open Sans') {
wp_enqueue_style( 'OpenSans', 'http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700' );
}
if ($options['title_font'] == 'Source Sans Pro' || $options['general_font'] == 'Source Sans Pro') {
wp_enqueue_style( 'SourceSansPro', 'http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700,400italic,700italic' );
}
if ($options['title_font'] == 'Ubuntu' || $options['general_font'] == 'Ubuntu') {
wp_enqueue_style( 'Ubuntu', 'http://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic,700italic' );
}
if ($options['title_font'] == 'Yanone Kaffeesatz') {
wp_enqueue_style( 'YanoneKaffeesatz', 'http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz' );
}
}
add_action( 'wp_enqueue_scripts', 'albinomouse_google_web_fonts' );
/**
* Add a style block with some configurations of the theme options.
* This function is attached to the wp_head action hook.
*/
include("inc/color.php"); // Include phpColors by Primoz MIT-License
use phpColors\Color;
function albinomouse_add_custom_styles() {
$options = get_option( 'albinomouse' );
$link_color = $options['link_footer_color'];
$header_bg = $options['header-background'];
$footer_cols = $options['footer-layout'];
$primary = new Color($link_color); ?>
' . __( "Continue reading", "albinomouse" ) . '';
}
add_filter('excerpt_more', 'excerpt_readmore');
/**
* Display a notice that can be dismissed
*/
add_action('admin_notices', 'albinomouse_200_admin_notice');
function albinomouse_200_admin_notice() {
global $current_user ;
$user_id = $current_user->ID;
/* Check that the user hasn't already clicked to ignore the message */
if ( ! get_user_meta($user_id, 'albinomouse_200_ignore_notice') ) {
echo '';
printf(__('Please check your posts for shortcodes which were available in older versions of the theme AlbinoMouse. The theme guidelines do not allow shortcodes in themes anymore. Hide Notice'), '?albinomouse_200_nag_ignore=0');
echo "
";
}
}
add_action('admin_init', 'albinomouse_200_nag_ignore');
function albinomouse_200_nag_ignore() {
global $current_user;
$user_id = $current_user->ID;
/* If user clicks to ignore the notice, add that to their user meta */
if ( isset($_GET['albinomouse_200_nag_ignore']) && '0' == $_GET['albinomouse_200_nag_ignore'] ) {
add_user_meta($user_id, 'albinomouse_200_ignore_notice', 'true', true);
}
}
?>