992, 'height' => 1300 ) ); // custom background add_theme_support( 'custom-background', array( 'default-color' => '#f1f1f1' ) ); // Register primary menu. register_nav_menu( 'primary', __( 'Primary Menu', 'aesblo' ) ); } endif; // end aesblo_setup(). add_action( 'after_setup_theme', 'aesblo_setup' ); /** * 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', 'http://fonts.googleapis.com/css?family=Alegreya+Sans:400,400italic,700' ); // Font awesome wp_enqueue_style( 'aesblo-fontawesome', get_template_directory_uri() . '/assets/font-awesome/css/font-awesome.min.css' ); // Enclude style.css file. wp_enqueue_style( 'aesblo-style', get_stylesheet_uri() ); // 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' ) ) ); // Comment reply. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'aesblo_enqueue_scripts' ); /** * 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 ) ) { $item_output .= ''; } $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' ); /** * 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 ) { if ( is_admin() ) { } $link = sprintf( ' ...

    %2$s

    ', esc_url( get_permalink( get_the_ID() ) ), __( 'Continue reading »', 'aesblo' ) ); return $link; } add_filter( 'excerpt_more', 'aesblo_excerpt_more' ); /** * 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';