__( 'Main Menu', 'acosmin' ), 'mini-first' => __( 'Right Sidebar - First Menu', 'acosmin' ), 'mini-second' => __( 'Right Sidebar - Second Menu', 'acosmin' ), ) ); // This feature enables post and comment RSS feed links to head. add_theme_support( 'automatic-feed-links' ); // This feature allows the use of HTML5 markup for the comment forms, search forms and comment lists. add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form' ) ); // Adding theme support for TinyMCE editor style. $selected_ff = ac_get_selected_ff(); add_editor_style( array( 'assets/css/editor-style.css', 'assets/css/es-' . $selected_ff . '.css', ac_font_url( $selected_ff ) ) ); // Custom header and background support if ( isset( $ac_custom_header ) && isset( $ac_custom_bg ) ) { add_theme_support( 'custom-header' ); add_theme_support( 'custom-background' ); } // This theme uses its own gallery styles. add_filter( 'use_default_gallery_style', '__return_false' ); } endif; add_action( 'after_setup_theme', 'ac_setup' ); /* Load CSS files /* ------------------------------------ */ function ac_css_files() { // Register wp_register_style( 'ac_webfonts_' . ac_get_selected_ff(), ac_font_url( ac_get_selected_ff() ), array(), null); // Enqueue wp_enqueue_style( 'ac_style', get_template_directory_uri() . '/style.css', array(), '1.0.3', 'all' ); wp_enqueue_style( 'ac_custom_css', get_template_directory_uri() . '/assets/css/custom.css', array(), null ); wp_enqueue_style( 'ac_media_queries', get_template_directory_uri() . '/assets/css/media-queries.css', array(), '1.0', 'all' ); wp_enqueue_style( 'ac_icons', get_template_directory_uri() . '/assets/icons/css/font-awesome.min.css', array(), '4.0.3', 'all' ); wp_enqueue_style( 'ac_webfonts_' . ac_get_selected_ff() ); } add_action( 'wp_enqueue_scripts', 'ac_css_files', 99 ); /* Load JavaScript files /* ------------------------------------ */ function ac_js_files() { // Register wp_register_script( 'ac_js_myscripts', get_template_directory_uri() . '/assets/js/myscripts.js', array('jquery'), '1.0', true ); wp_register_script( 'ac_js_html5', get_template_directory_uri() . '/assets/js/html5.js', array('jquery'), '1.0', false ); wp_register_script( 'ac_js_idtabs', get_template_directory_uri() . '/assets/js/idtabs.js', array('jquery'), '3.0', true ); wp_register_script( 'ac_js_slider', get_template_directory_uri() . '/assets/js/slider.js', array('jquery'), '0.3.0', true ); wp_register_script( 'ac_js_menudropdown', get_template_directory_uri() . '/assets/js/menu-dropdown.js', array('jquery'), '1.4.8', true ); wp_register_script( 'ac_js_fitvids', get_template_directory_uri() . '/assets/js/jquery.fitvids.js', array('jquery'), '1.1', true ); // Enqueue wp_enqueue_script( 'ac_js_fitvids' ); wp_enqueue_script( 'ac_js_idtabs' ); wp_enqueue_script( 'ac_js_menudropdown' ); wp_enqueue_script( 'ac_js_slider' ); wp_enqueue_script( 'ac_js_myscripts' ); wp_enqueue_script( 'ac_js_html5' ); // Comments Script if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'ac_js_files' ); /* Font Families /* ------------------------------------ */ function ac_font_url( $font_type = 'style1' ) { // You have 4 optios // Please select a option from the WP Theme Customise, Content tab. $font_url = ''; $google_fonts_url = "//fonts.googleapis.com/css"; if( $font_type == 'style1' ) { $font_url = add_query_arg( 'family', urlencode( 'Montserrat:400,700|Questrial|Arimo:400,700|Source Sans Pro:400,700,400italic,700italic' ), $google_fonts_url ); } elseif( $font_type == 'style2' ) { $font_url = add_query_arg( 'family', urlencode( 'PT Serif:400,700,400italic,700italic|Montserrat:400,700|Questrial' ), $google_fonts_url ); } elseif( $font_type == 'style3' ) { $font_url = add_query_arg( 'family', urlencode( 'Roboto:400,700italic,700,400italic|Montserrat:400,700|Questrial' ), $google_fonts_url ); } elseif( $font_type == 'style4' ) { $font_url = add_query_arg( 'family', urlencode( 'PT Sans:400,700,400italic,700italic' ), $google_fonts_url ); } return $font_url; } /* Font Styles /* ------------------------------------ */ function ac_font_styles() { $selected = get_theme_mod('ac_font_select'); $font_style_url = get_stylesheet_directory_uri() . '/assets/css/font-' . $selected . '.css'; if( $selected == '' || $selected == 'style1' ) { return; } else { wp_enqueue_style( 'ac_webfonts_selected-' . $selected, $font_style_url, array(), null ); } } add_action( 'wp_enqueue_scripts', 'ac_font_styles', 100 ); /* Get selected font /* ------------------------------------ */ function ac_get_selected_ff() { // Check if a font is selected $selected = get_theme_mod( 'ac_font_select' ); if ( $selected == '' ) { $current_font = 'style1'; } else { $current_font = $selected; } return $current_font; } /* Setup posts excerpt /* ------------------------------------ */ function ac_custom_excerpt_length( $length ) { return 45; } add_filter( 'excerpt_length', 'ac_custom_excerpt_length', 999 ); function ac_no_excerpt_dots( $more ) { return ''; } add_filter('excerpt_more', 'ac_no_excerpt_dots'); /* Widgets and Sidebars Setup /* ------------------------------------ */ function ac_sidebars_widgets() { // Include Widgets require_once get_template_directory() . '/acosmin/widgets/ac-default-widgets-init.php'; require_once get_template_directory() . '/acosmin/widgets/ac-custom-widgets-init.php'; // Main sidebar that appears on the right. register_sidebar( array( 'name' => __( 'Main Sidebar', 'acosmin' ), 'id' => 'main-sidebar', 'description' => __( 'Main sidebar that appears on the right.', 'acosmin' ), 'before_widget' => '', 'before_title' => '', ) ); // Same as above, designed for the articles area. register_sidebar( array( 'name' => __( 'Posts Sidebar', 'acosmin' ), 'id' => 'posts-sidebar', 'description' => __( 'Same as "Main Sidebar", designed for the posts.', 'acosmin' ), 'before_widget' => '', 'before_title' => '', ) ); } add_action( 'widgets_init', 'ac_sidebars_widgets' ); /* Title formatting /* ------------------------------------ */ function ac_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) { return $title; } // Add the site name. $title .= get_bloginfo( 'name' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) { $title = "$title $sep $site_description"; } // Add a page number if necessary. if ( $paged >= 2 || $page >= 2 ) { $title = "$title $sep " . sprintf( __( 'Page %s', 'acosmin' ), max( $paged, $page ) ); } return $title; } add_filter( 'wp_title', 'ac_wp_title', 10, 2 ); /* Set mini-sidebar to disabled /* ------------------------------------ */ function ac_mini_disabled() { // Adds a class to the mini-sidebar if you select to disable it $is_enabled = get_theme_mod( 'ac_disable_minisidebar' ); $class = ''; if ( $is_enabled ) { $class = ' mini-disabled'; } echo $class; } /* Comment template /* ------------------------------------ */ function ac_comment_template( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; $classes = array( 'clearfix' ); switch ( $comment->comment_type ) : case '' : ?>
  • id="li-comment-">
    %s says:', 'acosmin'), get_comment_author_link()) ?>
    comment_approved == '0') : ?>
    $depth, 'before' => '
    ', 'after' => '
    ','max_depth' => $args['max_depth']))) ?>
  • id="li-pingback-">
  • id="li-trackback-">
  • '; } else { if ( $logo_text != '' ) { echo esc_html( $logo_text ); } } } function ac_logo_class() { if ( get_theme_mod( 'ac_logo_image' ) ) { echo ' logo-image'; } } /* Pagination /* ------------------------------------ */ function ac_paginate() { if ( $GLOBALS['wp_query']->max_num_pages < 2 ) { return; } $paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1; $pagenum_link = html_entity_decode( get_pagenum_link() ); $query_args = array(); $url_parts = explode( '?', $pagenum_link ); if ( isset( $url_parts[1] ) ) { wp_parse_str( $url_parts[1], $query_args ); } $pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link ); $pagenum_link = trailingslashit( $pagenum_link ) . '%_%'; $format = $GLOBALS['wp_rewrite']->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : ''; $format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit( 'page/%#%', 'paged' ) : '?paged=%#%'; $links = paginate_links( array( 'base' => $pagenum_link, 'format' => $format, 'total' => $GLOBALS['wp_query']->max_num_pages, 'current' => $paged, 'mid_size' => 1, 'add_args' => array_map( 'urlencode', $query_args ), 'prev_text' => __( '← Previous', 'acosmin' ), 'next_text' => __( 'Next →', 'acosmin' ), ) ); if ( $links ) : ?> 2 ) { if ( of_get_option( 'ac_slider_auto_start' ) ) { $slider_autostart = 'true'; } else { $slider_autostart = 'false'; } $slider_transition_delay = of_get_option( 'ac_slider_interval' ); ?> 'ac_featured_article', 'meta_value' => 1, )); $count_featured_posts = count( $featured_posts_nr ); return $count_featured_posts; } /* Post pagination /* ------------------------------------ */ function ac_post_nav_arrows() { global $post; $prev_post = get_next_post(); $next_post = get_previous_post(); if( $prev_post ) { $prev_post_id = $prev_post->ID; $prev_post_url = get_permalink($prev_post_id); }; if( $next_post ) { $next_post_id = $next_post->ID; $next_post_url = get_permalink($next_post_id); }; echo '
    '; if( $prev_post ) { echo ''; } else { echo '' . ac_icon('angle-left', false) . ''; } if( $next_post ) { echo ''; } else { echo '' . ac_icon('angle-right', false) . ''; } echo '
    '; } ?>