__( 'Main Menu', 'modernwpthemes' ),
) );
}
endif; // Modern WP Themes_setup
add_action( 'after_setup_theme', 'modernwpthemes_setup' );
/**
* Register widgetized area and update sidebar with default widgets
*/
function modernwpthemes_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'modernwpthemes' ),
'id' => 'sidebar-1',
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Sub Footer 1', 'modernwpthemes' ),
'id' => 'sidebar-2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Sub Footer 2', 'modernwpthemes' ),
'id' => 'sidebar-3',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Sub Footer 3', 'modernwpthemes' ),
'id' => 'sidebar-4',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Sub Footer 4', 'modernwpthemes' ),
'id' => 'sidebar-5',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'modernwpthemes_widgets_init' );
/**
* Count the number of footer sidebars to enable dynamic classes for the footer
*
* @since 1.0
*/
function modernwpthemes_footer_sidebar_class() {
$count = 0;
if ( is_active_sidebar( 'sidebar-2' ) )
$count++;
if ( is_active_sidebar( 'sidebar-3' ) )
$count++;
if ( is_active_sidebar( 'sidebar-4' ) )
$count++;
if ( is_active_sidebar( 'sidebar-5' ) )
$count++;
$class = '';
switch ( $count ) {
case '1':
$class = 'site-extra extra-one';
break;
case '2':
$class = 'site-extra extra-two';
break;
case '3':
$class = 'site-extra extra-three';
break;
case '4':
$class = 'site-extra extra-four';
break;
}
if ( $class )
echo 'class="' . $class . '"';
}
/**
* Enqueue scripts and styles
*/
function modernwpthemes_scripts() {
$protocol = is_ssl() ? 'https' : 'http';
$query_args = array(
'family' => 'Open+Sans+Condensed:300,300italic,700',
);
wp_enqueue_style( 'fonts', add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" ) );
wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/css/font-awesome.css' );
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css' );
wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array( 'jquery' ) );
wp_enqueue_script( 'superfish', get_template_directory_uri() . '/js/superfish.js', array( 'jquery' ) );
wp_enqueue_script( 'supersubs', get_template_directory_uri() . '/js/supersubs.js', array( 'jquery' ) );
wp_enqueue_script( 'settings', get_template_directory_uri() . '/js/settings.js', array( 'jquery' ) );
wp_enqueue_script( 'scripts', get_template_directory_uri() . '/js/scripts.js', array( 'jquery' ) );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'modernwpthemes_scripts' );
define('modernwpthemes_PATH', get_template_directory() );
/**
* Custom functions that act independently of the theme templates.
*/
require modernwpthemes_PATH . '/inc/extras.php';
/**
* Custom template tags for this theme.
*/
require modernwpthemes_PATH . '/inc/template-tags.php';
/**
* Add social links on user profile page.
*/
require modernwpthemes_PATH . '/inc/user-profile.php';
/**
* Add custom widgets
*/
require modernwpthemes_PATH . '/inc/custom-widgets.php';
/* TGM plugin activation
/* ------------------------------------ */
require_once dirname( __FILE__ ) . '/inc/class-tgm-plugin-activation.php';
function modernwpthemes_plugins() {
// Add the following plugins
$plugins = array(
array(
'name' => 'WP-PageNavi',
'slug' => 'wp-pagenavi',
'required' => false,
'force_activation' => false,
'force_deactivation'=> false,
),
);
tgmpa( $plugins );
}
add_action( 'tgmpa_register', 'modernwpthemes_plugins' );
/* Custom favicon
/* ------------------------------------ */
function modernwpthemes_favicon() {
if ( of_get_option('favicon') ) {
echo ''."\n";
}
}
add_filter( 'wp_head', 'modernwpthemes_favicon' );
/* Theme Options Background Options
/* ------------------------------------ */
add_action('wp_head', 'modernwpthemes_print_customstyles', 1000);
function modernwpthemes_print_customstyles() {
echo '';
}
function modernwpthemes_print_background( $option, $selector ) {
$bg = of_get_option($option, false);
if ($bg) {
$bg_img = $bg['image'] ? 'background-image:url('.$bg['image'].')!important;' : '';
$bg_repeat = $bg['repeat'] ? 'background-repeat:'.$bg['repeat'].'!important;' : '';
$bg_position = $bg['position'] ? 'background-position:'.$bg['position'].'!important;' : '';
$bg_attachment = $bg['attachment'] ? 'background-attachment:'.$bg['attachment'].'!important;' : '';
$bg_color = $bg['color'] ? 'background-color:'.$bg['color'].'!important;' : '';
if ($bg_img || $bg_repeat || $bg_position || $bg_attachment || $bg_color) {
echo $selector.' { '.$bg_img.$bg_repeat.$bg_position.$bg_attachment.$bg_color.' }';
}
}
}
/* Theme Options Custom css
/* ------------------------------------ */
if (of_get_option('custom_css') != ''){
add_action('wp_head', 'modernwpthemes_custom_css');
function modernwpthemes_custom_css(){
$output = "\n";
echo $output;
}
}
/* Theme Options Primary Color
/* ------------------------------------ */
add_action('wp_head', 'theme_style_css');
/**
* Hooks the Custom Internal CSS to head section
*/
function theme_style_css() {
$primary_color = of_get_option( 'theme_color', '#43c6a9' );
$site_title_color = of_get_option( 'logo_text_color', '#2e3944' );
$site_description_color = of_get_option( 'site_description_color', '#999999' );
$footer_widget_text_color = of_get_option( 'footer_widget_text_color', '#2e3944' );
$footer_widget_link_color = of_get_option( 'footer_widget_link_color', '#2e3944' );
$footer_social_icon_bg_color = of_get_option( 'footer_social_icon_bg_color', '#2e3944' );
$internal_css = ''; {
$internal_css = ' #main-navigation, .entry-summary a:hover.readmore-button, .widget_modernwpthemes_tabs .widget-tab-nav li.active a, .site-content [class*="navigation"] a, .site-footer, .page-header, #main-navigation li:hover li a:hover, #main-navigation li.sfHover li a:hover, #main-navigation li li a:hover, #main-navigation li li.sfHover > a, #main-navigation li li.current_page_item > a, #main-navigation li li.current-menu-item > a, #main-navigation li li.current-menu-parent > a, #main-navigation li li.current-page-parent > a, #main-navigation li li.current-page-ancestor > a, #main-navigation li li.current_page_ancestor > a, #main-navigation li li.current-menu-ancestor > a, #reply-title, button, a.button, input[type="button"], input[type="reset"], input[type="submit"]{ background: '.$primary_color.'; }
#back-top a { background-color: '.$primary_color.'; }
a, .entry-title a:hover, .entry-meta a time:before, .entry-meta .byline:before, .entry-meta .author a:before, .entry-meta [class^="fa-"]:before, .comments-link a:hover, .widget_modernwpthemes_tabs .widget-entry-content h4 a, .widget_modernwpthemes_tabs .widget-entry-summary h4 a, .widget_modernwpthemes_tabs .widget-tab-nav li a:hover, .widget_modernwpthemes_tabs .widget-tab-nav li a:focus, .widget_recent_entries li a:before, .widget li a:hover, .widget_archive li a:before, .widget_recent_comments li:before, .widget_categories li a:before, .widget_modernwpthemes_tabs #widget-tab-tags a:hover, .site-extra .widget a:hover, .site-content [class*="navigation"] a:hover, .wp-pagenavi a:hover, .wp-pagenavi a:active, .wp-pagenavi span.current, .paging-navigation .wp-pagenavi a:hover, .paging-navigation .wp-pagenavi a:active, .paging-navigation .wp-pagenavi span.current, .author-info .author-content h3, .comment-list li.comment .reply a, .widget_nav_menu li a:before{ color: '.$primary_color.'; }
.widget-title span, .widget_modernwpthemes_tabs .widget-tab-nav {border-bottom:1px solid '.$primary_color.';}
.entry-summary a.readmore-button, .paging-navigation .wp-pagenavi a:hover, .paging-navigation .wp-pagenavi a:active, .paging-navigation .wp-pagenavi span.current{border-bottom:3px solid '.$primary_color.';}
.site-sidebar .widget, .hentry, .single-post .hentry, .comment-list li.comment .comment-body, #commentform {border-bottom:4px solid '.$primary_color.';}
#main-navigation li:hover ul, #main-navigation li.sfHover ul {border-top:4px solid '.$primary_color.'; border-bottom:4px solid '.$primary_color.';}
.widget_modernwpthemes_social_icons li a [class^="fa-"]:before{border-bottom:2px solid '.$primary_color.';}
blockquote{border-left:5px solid '.$primary_color.';}
.site-title a{color: '.$site_title_color.';}
.site-description{color: '.$site_description_color.';}
.site-extra .widget-title span {color: '.$footer_widget_text_color.';}
.site-extra .widget a {color: '.$footer_widget_link_color.';}
.site-extra .widget_modernwpthemes_social_icons li a [class^="fa-"]:before {background: '.$footer_social_icon_bg_color.';}
';}
if( !empty( $internal_css ) ) {
?>
";
// custom JS
$output .= "\n".htmlspecialchars_decode(of_get_option('custom_js'));
$output .= "\n";
echo $output;
}
}