992,
'height' => 1300
) );
// custom background
add_theme_support( 'custom-background', array(
'default-color' => '#f1f1f1'
) );
// Register primary menu.
register_nav_menu( 'primary', __( 'Primary Menu', 'aesblo' ) );
/*
* This theme styles the visual editor to resemble the theme style,
* specifically font, colors, icons, and column width.
*/
add_editor_style( array( 'assets/css/editor-style.css', aesblo_fonts_url() ) );
}
endif; // end aesblo_setup().
add_action( 'after_setup_theme', 'aesblo_setup' );
if ( ! function_exists( 'aesblo_fonts_url' ) ) :
/**
* Register Google fonts for the theme.
*
* @since 1.0.1
*
* @return string Google fonts URL for the theme.
*/
function aesblo_fonts_url() {
$fonts_url = '';
$fonts = array();
/* translators: If there are characters in your language that are not supported by Alegreya Sans font, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Alegreya Sans font: on or off', 'aesblo' ) ) {
$fonts[] = 'Alegreya Sans:400,400italic,700';
}
if ( $fonts ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $fonts ) ),
), 'https://fonts.googleapis.com/css' );
}
return $fonts_url;
}
endif;
/**
* JavaScript Detection.
*
* Adds a `js` class to the root `` element when JavaScript is detected.
*
* @since 1.0.1
*/
function aesblo_javascript_detection() {
echo "\n";
}
add_action( 'wp_head', 'aesblo_javascript_detection', 0 );
/**
* Register widgets area.
*
* @since 1.0.0
*/
function aesblo_register_sidebars() {
// Primary widget.
register_sidebar( array(
'name' => __( 'Primary Sidebar', 'aesblo' ),
'id' => 'primary-sidebar',
'description' => __( 'Displaying under the nav menu.', 'aesblo' ),
'class' => '',
'before_widget' => '',
'before_title' => '
',
'after_title' => '
'
) );
// Secondary widget.
register_sidebar( array(
'name' => __( 'Secondary Sidebar', 'aesblo' ),
'id' => 'secondary-sidebar',
'description' => __( 'Displaying when click the toggle icon.', 'aesblo' ),
'class' => '',
'before_widget' => '',
'before_title' => '',
'after_title' => '
'
) );
}
add_action( 'widgets_init', 'aesblo_register_sidebars' );
/**
* Enqueue scripts and styles.
*
* @since 1.0.0
*/
function aesblo_enqueue_scripts() {
// Google fonts
wp_enqueue_style( 'aseblo-Alegreya-Sans', aesblo_fonts_url() );
// Font awesome
wp_enqueue_style( 'aesblo-fontawesome', get_template_directory_uri() . '/assets/font-awesome/css/font-awesome.min.css' );
// Include style.css file.
wp_enqueue_style( 'aesblo-style', get_stylesheet_uri() );
// Translate the theme description in the style.css file header.
__( 'Aesblo is a modern and aesthetic theme. Excerpt the regular functions it also include some excellent transition and animation effects that make your blog to look awesome. You can define your favorite color scheme from Customizer, so it is also a flexible blog theme. It always works well whether your visitors arrive by smartphone, tablet, laptop or desktop computer. It supports the popular modern browsers, includes IE(9+), Chrome, Opera, Safari, Firefox. Click to see the Demo and the Documentation', 'aesblo' );
// Theme javascript functions file.
wp_enqueue_script( 'aesblo-functions', get_template_directory_uri() . '/assets/js/functions.js', array( 'jquery' ), '', true );
wp_localize_script( 'aesblo-functions', 'aesblo', array(
'videoResponsive' => apply_filters( 'aesblo_video_responsive', '16:9' ),
'expandMenu' => __( 'expand child menu', 'aesblo' ),
'collapseMenu' => __( 'collapse child menu', 'aesblo' )
) );
// Comment reply.
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'aesblo_enqueue_scripts' );
if ( ! class_exists( 'aesblo_walker_primary_nav_menu' ) ) {
/**
* Primary nav menu walker.
*
* @since 1.0.0
*/
class aesblo_walker_primary_nav_menu extends Walker_Nav_Menu {
/**
* Start the element output.
*
* @see Walker::start_el()
*
* @since 1.0.0
*
* @param string $output Passed by reference. Used to append additional content.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param array $args An array of arguments. @see wp_nav_menu()
* @param int $id Current item ID.
*/
public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
/**
* Filter the CSS class(es) applied to a menu item's list item element.
*
* @param array $classes The CSS classes that are applied to the menu item's `` element.
* @param object $item The current menu item.
* @param array $args An array of {@see wp_nav_menu()} arguments.
* @param int $depth Depth of menu item. Used for padding.
*/
// Fetch the icon class name
$classes = array_filter( $classes );
$icon_class = '';
if ( $classes ) {
$i = 0;
foreach ( $classes as $class ) {
if ( false !== strpos( $class, 'fa-' ) ) {
$icon_class = $class;
unset( $classes[ $i ] );
break;
}
$i++;
}
}
$class_names = join( ' ', apply_filters( 'nav_menu_css_class', $classes, $item, $args, $depth ) );
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
/**
* Filter the ID applied to a menu item's list item element.
*
* @param string $menu_id The ID that is applied to the menu item's `` element.
* @param object $item The current menu item.
* @param array $args An array of {@see wp_nav_menu()} arguments.
* @param int $depth Depth of menu item. Used for padding.
*/
$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args, $depth );
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$output .= $indent . '';
$atts = array();
$atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';
$atts['target'] = ! empty( $item->target ) ? $item->target : '';
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
/**
* Filter the HTML attributes applied to a menu item's anchor element.
*
* @param array $atts {
* The HTML attributes applied to the menu item's `` element, empty strings are ignored.
*
* @type string $title Title attribute.
* @type string $target Target attribute.
* @type string $rel The rel attribute.
* @type string $href The href attribute.
* }
* @param object $item The current menu item.
* @param array $args An array of {@see wp_nav_menu()} arguments.
* @param int $depth Depth of menu item. Used for padding.
*/
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );
$attributes = '';
foreach ( $atts as $attr => $value ) {
if ( ! empty( $value ) ) {
$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
$attributes .= ' ' . $attr . '="' . $value . '"';
}
}
$item_output = $args->before;
$item_output .= '';
// Add a icon element into the a tag.
if ( $icon_class ) {
$item_output .= sprintf( '', $icon_class );
}
// Add menu description.
$item_description = $item->description ? '' : '';
/** This filter is documented in wp-includes/post-template.php */
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $item_description . $args->link_after;
$item_output .= '';
// Add icon for opening or closing sub menus.
if ( in_array( 'menu-item-has-children', (array) $item->classes ) ) {
$aria_expanded = 'false';
$screen_reader_text = sprintf( '%s', __( 'expand child menu', 'aesblo' ) );
if ( in_array( 'current-menu-ancestor', (array) $item->classes ) ) {
$aria_expanded = 'true';
$screen_reader_text = sprintf( '%s', __( 'collapse child menu', 'aesblo' ) );
}
$item_output .= sprintf(
'',
$aria_expanded,
$screen_reader_text
);
}
$item_output .= $args->after;
/**
* Filter a menu item's starting output.
*
* The menu item's starting output only includes `$args->before`, the opening ``,
* the menu item's title, the closing ``, and `$args->after`. Currently, there is
* no filter for modifying the opening and closing `` for a menu item.
*
* @param string $item_output The menu item's starting HTML output.
* @param object $item Menu item data object.
* @param int $depth Depth of menu item. Used for padding.
* @param array $args An array of {@see wp_nav_menu()} arguments.
*/
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
}
}
/**
* Add post classes.
*
* @since 1.0.0
*
* @return
*/
function aesblo_post_class( $class ) {
if ( '' === get_the_title() ) {
$class[] = 'no-post-title';
}
return $class;
}
add_filter( 'post_class', 'aesblo_post_class' );
if ( ! function_exists( 'aesblo_excerpt_more' ) && ! is_admin() ) :
/**
* Replaces "[...]" (appended to automatically generated excerpts) with ... and a 'Continue reading' link.
*
* @since 1.0.0
*
* @return string 'Continue reading' link prepended with an ellipsis.
*/
function aesblo_excerpt_more( $more ) {
$link = sprintf( ' ... %2$s
',
esc_url( get_permalink( get_the_ID() ) ),
sprintf( __( 'Continue reading » %s', 'aesblo' ), '' . get_the_title( get_the_ID() ) . '' )
);
return $link;
}
add_filter( 'excerpt_more', 'aesblo_excerpt_more' );
endif;
/**
* Custom template tags.
*
* @since 1.0.0
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom Style.
*
* @since 1.0.0
*/
require get_template_directory() . '/inc/class-custom-style.php';
/**
* Customizer
*
* @since 1.0.0
*/
require get_template_directory() . '/inc/class-customizer.php';