__( 'Primary Menu', 'adle' ), 'footer-links' => __( 'Footer Links', 'adle' ) // menu in footer ) ); // Enable support for Post Formats. add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); // Setup the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'adle_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); /* * Let WordPress manage the document title. * By adding theme support, we declare that this theme does not use a * hard-coded tag in the document head, and expect WordPress to provide it for us. */ add_theme_support( 'title-tag' ); } endif; // adle_setup add_action( 'after_setup_theme', 'adle_setup' ); /** * Register widgetized area and update sidebar with default widgets. */ function adle_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar', 'adle' ), 'id' => 'sidebar-1', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); register_sidebar(array( 'id' => 'home-widget-1', 'name' => __( 'Homepage Widget 1', 'adle' ), 'description' => __( 'Displays on the Home Page', 'adle' ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>', )); register_sidebar(array( 'id' => 'home-widget-2', 'name' => __( 'Homepage Widget 2', 'adle' ), 'description' => __( 'Displays on the Home Page', 'adle' ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>', )); register_sidebar(array( 'id' => 'home-widget-3', 'name' => __( 'Homepage Widget 3', 'adle' ), 'description' => __( 'Displays on the Home Page', 'adle' ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>', )); register_sidebar(array( 'id' => 'footer-widget-1', 'name' => __( 'Footer Widget 1', 'adle' ), 'description' => __( 'Used for footer widget area', 'adle' ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>', )); register_sidebar(array( 'id' => 'footer-widget-2', 'name' => __( 'Footer Widget 2', 'adle' ), 'description' => __( 'Used for footer widget area', 'adle' ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>', )); register_sidebar(array( 'id' => 'footer-widget-3', 'name' => __( 'Footer Widget 3', 'adle' ), 'description' => __( 'Used for footer widget area', 'adle' ), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3 class="widgettitle">', 'after_title' => '</h3>', )); register_widget( 'adle_social_widget' ); register_widget( 'adle_popular_posts_widget' ); } add_action( 'widgets_init', 'adle_widgets_init' ); include(get_template_directory() . "/inc/widgets/widget-popular-posts.php"); include(get_template_directory() . "/inc/widgets/widget-social.php"); /** * Enqueue scripts and styles. */ function adle_scripts() { wp_enqueue_style( 'adle-bootstrap', get_template_directory_uri() . '/inc/css/bootstrap.min.css' ); wp_enqueue_style( 'adle-icons', get_template_directory_uri().'/inc/css/font-awesome.min.css' ); wp_enqueue_style( 'adle-style', get_stylesheet_uri() ); wp_enqueue_script('adle-bootstrapjs', get_template_directory_uri().'/inc/js/bootstrap.min.js', array('jquery') ); wp_enqueue_script( 'adle-main', get_template_directory_uri() . '/inc/js/main.js', array('jquery'), '1.5.4', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'adle_scripts' ); /** * Add HTML5 shiv and Respond.js for IE8 support of HTML5 elements and media queries */ function adle_ie_support_header() { echo '<!--[if lt IE 9]>'. "\n"; echo '<script src="' . esc_url( get_template_directory_uri() . '/inc/js/html5shiv.min.js' ) . '"></script>'. "\n"; echo '<script src="' . esc_url( get_template_directory_uri() . '/inc/js/respond.min.js' ) . '"></script>'. "\n"; echo '<![endif]-->'. "\n"; } add_action( 'wp_head', 'adle_ie_support_header', 11 ); /** * Implement the Custom Header feature. */ require get_template_directory() . '/inc/custom-header.php'; /** * 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'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ require get_template_directory() . '/inc/jetpack.php'; /** * Load custom nav walker */ require get_template_directory() . '/inc/navwalker.php'; /** * Metabox file load */ require get_template_directory() . '/inc/metaboxes.php'; /** * Register Social Icon menu */ add_action( 'init', 'register_social_menu' ); function register_social_menu() { register_nav_menu( 'social-menu', _x( 'Social Menu', 'nav menu location', 'adle' ) ); } /* Globals variables */ global $options_categories; $options_categories = array(); $options_categories_obj = get_categories(); foreach ($options_categories_obj as $category) { $options_categories[$category->cat_ID] = $category->cat_name; } global $site_layout; $site_layout = array('side-pull-left' => esc_html__('Right Sidebar', 'adle'),'side-pull-right' => esc_html__('Left Sidebar', 'adle'),'no-sidebar' => esc_html__('No Sidebar', 'adle'),'full-width' => esc_html__('Full Width', 'adle')); // Typography Options global $typography_options; $typography_options = array( 'sizes' => array( '6px' => '6px','10px' => '10px','12px' => '12px','14px' => '14px','15px' => '15px','16px' => '16px','18px'=> '18px','20px' => '20px','24px' => '24px','28px' => '28px','32px' => '32px','36px' => '36px','42px' => '42px','48px' => '48px' ), 'faces' => array( 'arial' => 'Arial,Helvetica,sans-serif', 'verdana' => 'Verdana,Geneva,sans-serif', 'trebuchet' => 'Trebuchet,Helvetica,sans-serif', 'georgia' => 'Georgia,serif', 'times' => 'Times New Roman,Times, serif', 'tahoma' => 'Tahoma,Geneva,sans-serif', 'Open Sans' => 'Open Sans,sans-serif', 'palatino' => 'Palatino,serif', 'helvetica' => 'Helvetica,Arial,sans-serif', 'helvetica-neue' => 'Helvetica Neue,Helvetica,Arial,sans-serif' ), 'styles' => array( 'normal' => 'Normal','bold' => 'Bold' ), 'color' => true ); // Typography Defaults global $typography_defaults; $typography_defaults = array( 'size' => '14px', 'face' => 'helvetica-neue', 'style' => 'normal', 'color' => '#6B6B6B' ); /** * WordPress Bootstrap Pagination */ function wp_bootstrap_pagination( $args = array() ) { $defaults = array( 'range' => 4, 'custom_query' => FALSE, 'previous_string' => __( 'Previous', 'adle' ), 'next_string' => __( 'Next', 'adle' ), 'before_output' => '<div class="container"><ul class="pagination">', 'after_output' => '</ul></div>' ); $args = wp_parse_args( $args, apply_filters( 'wp_bootstrap_pagination_defaults', $defaults ) ); $args['range'] = (int) $args['range'] - 1; if ( !$args['custom_query'] ) $args['custom_query'] = @$GLOBALS['wp_query']; $count = (int) $args['custom_query']->max_num_pages; $page = intval( get_query_var( 'paged' ) ); $ceil = ceil( $args['range'] / 2 ); if ( $count <= 1 ) return FALSE; if ( !$page ) $page = 1; if ( $count > $args['range'] ) { if ( $page <= $args['range'] ) { $min = 1; $max = $args['range'] + 1; } elseif ( $page >= ($count - $ceil) ) { $min = $count - $args['range']; $max = $count; } elseif ( $page >= $args['range'] && $page < ($count - $ceil) ) { $min = $page - $ceil; $max = $page + $ceil; } } else { $min = 1; $max = $count; } $echo = ''; $previous = intval($page) - 1; $previous = esc_attr( get_pagenum_link($previous) ); $firstpage = esc_attr( get_pagenum_link(1) ); if ( $firstpage && (1 != $page) ) $echo .= '<li class="previous"><a href="' . $firstpage . '">' . __( 'First', 'adle' ) . '</a></li>'; if ( $previous && (1 != $page) ) $echo .= '<li><a href="' . $previous . '" title="' . __( 'previous', 'adle') . '">← ' . $args['previous_string'] . '</a></li>'; if ( !empty($min) && !empty($max) ) { for( $i = $min; $i <= $max; $i++ ) { if ($page == $i) { $echo .= '<li class="active"><span class="active">' . str_pad( (int)$i, 2, '0', STR_PAD_LEFT ) . '</span></li>'; } else { $echo .= sprintf( '<li><a href="%s">%002d</a></li>', esc_attr( get_pagenum_link($i) ), $i ); } } } $next = intval($page) + 1; $next = esc_attr( get_pagenum_link($next) ); if ($next && ($count != $page) ) $echo .= '<li><a href="' . $next . '" title="' . __( 'next', 'adle') . '">' . $args['next_string'] . ' →</a></li>'; $lastpage = esc_attr( get_pagenum_link($count) ); if ( $lastpage ) { $echo .= '<li class="next"><a href="' . $lastpage . '">' . __( 'Last', 'adle' ) . '</a></li>'; } if ( isset($echo) ) echo $args['before_output'] . $echo . $args['after_output']; } /** * Registers an editor stylesheet for the theme. */ function adle_theme_add_editor_styles() { add_editor_style( 'custom-editor-style.css' ); } add_action( 'admin_init', 'adle_theme_add_editor_styles' ); /** * Helper function to return the theme option value. * If no value has been saved, it returns $default. */ if ( ! function_exists( 'of_get_option' ) ) : function of_get_option( $name, $default = false ) { $option_name = ''; // Get option settings from database $options = get_option( 'adle' ); // Return specific option if ( isset( $options[$name] ) ) { return $options[$name]; } return $default; } endif;