Forbidden'; exit();} global $elano_options; if ( !class_exists( 'ReduxFramework' ) && file_exists( dirname( __FILE__ ) . '/ReduxCore/framework.php' ) ) { require_once( dirname( __FILE__ ) . '/ReduxCore/framework.php' ); } if ( !isset( $redux_demo ) && file_exists( dirname( __FILE__ ) . '/theme-config.php' ) ) { require_once( dirname( __FILE__ ) . '/theme-config.php' ); } /********************************************************************* * THEME SETUP */ function elano_setup() { global $elano_options; // Translations support. Find language files in elano/languages load_theme_textdomain('elano', get_template_directory().'/languages'); $locale = get_locale(); $locale_file = get_template_directory()."/languages/{$locale}.php"; if(is_readable($locale_file)) { require_once($locale_file); } // Set content width global $content_width; if (!isset($content_width)) $content_width = 720; // Editor style (editor-style.css) add_editor_style(array('assets/css/editor-style.css')); // Load plugin checker require(get_template_directory() . '/inc/plugin-activation.php'); // Widget areas function theme_slug_widgets_init() { // Sidebar right register_sidebar(array( 'name' => "Blog Sidebar", 'id' => "elano-widgets-aside-right", 'description' => __('Widgets placed here will display in the right sidebar', 'elano'), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); // Footer Block 1 register_sidebar(array( 'name' => "Footer Block 1", 'id' => "elano-widgets-footer-block-1", 'description' => __('Widgets placed here will display in the first footer block', 'elano'), 'before_widget' => '
', 'after_widget' => '
' )); // Footer Block 2 register_sidebar(array( 'name' => "Footer Block 2", 'id' => "elano-widgets-footer-block-2", 'description' => __('Widgets placed here will display in the second footer block', 'elano'), 'before_widget' => '
', 'after_widget' => '
' )); // Footer Block 3 register_sidebar(array( 'name' => "Footer Block 3", 'id' => "elano-widgets-footer-block-3", 'description' => __('Widgets placed here will display in the third footer block', 'elano'), 'before_widget' => '
', 'after_widget' => '
' )); // Footer Block 4 register_sidebar(array( 'name' => "Footer Block 4", 'id' => "elano-widgets-footer-block-4", 'description' => __('Widgets placed here will display in the third footer block', 'elano'), 'before_widget' => '
', 'after_widget' => '
' )); } add_action( 'widgets_init', 'theme_slug_widgets_init' ); // Nav Menu (Custom menu support) if (function_exists('register_nav_menu')) : register_nav_menu('primary', __('Elano Primary Menu', 'elano')); endif; // Theme Features: Automatic Feed Links add_theme_support('automatic-feed-links'); // Theme Features: woocommerce add_theme_support( 'woocommerce' ); function custom_excerpt_length( $length ) { return 20; } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); // Theme Features: Post Thumbnails and custom image sizes for post-thumbnails add_theme_support('post-thumbnails'); // Theme Features: Post Formats add_theme_support('post-formats', array( 'gallery', 'image', 'link', 'quote', 'video', 'audio')); } add_action('after_setup_theme', 'elano_setup'); /** * Implement the Custom Header feature. * * @since Elano 1.0 */ require get_template_directory() . '/inc/custom-header.php'; /* * This theme supports custom background color and image, * and here we also set up the default background color. */ add_theme_support( 'custom-background', array( 'default-color' => '#ffffff', ) ); // The excerpt "more" button function elano_excerpt($text) { return str_replace('[…]', '', $text); } add_filter('the_excerpt', 'elano_excerpt'); /********************************************************************* * Function to load all theme assets (scripts and styles) in header */ function elano_load_theme_assets() { global $elano_options; // HTML5shiv // Do not know any method to enqueue a script with conditional tags! echo ' '; //Enqueue google fonts wp_enqueue_style('googlefont-Raleway', 'http://fonts.googleapis.com/css?family=Raleway:100,300,400,600,800'); wp_enqueue_style('googlefont-opensans', 'http://fonts.googleapis.com/css?family=Open+Sans:100,300,600,800'); wp_enqueue_style('googlefont-vollkorn', 'http://fonts.googleapis.com/css?family=Vollkorn:400italic,400'); if(isset($elano_options['typography-body']['font-family']) && $elano_options['typography-body']['font-family']!=''&& $elano_options['typography-body']['font-weight']!='') { wp_enqueue_style('googlefont-custom', 'http://fonts.googleapis.com/css?family='.esc_attr($elano_options['typography-body']['font-family'])); } if(isset($elano_options['typography-h1']['font-family']) && $elano_options['typography-h1']['font-family']!=''&& $elano_options['typography-h1']['font-weight']!='') { wp_enqueue_style('googlefont-h1', 'http://fonts.googleapis.com/css?family='.esc_attr($elano_options['typography-h1']['font-family'])); } if(isset($elano_options['typography-h2']['font-family']) && $elano_options['typography-h2']['font-family']!=''&& $elano_options['typography-h2']['font-weight']!='') { wp_enqueue_style('googlefont-h2', 'http://fonts.googleapis.com/css?family='.esc_attr($elano_options['typography-h2']['font-family'])); } if(isset($elano_options['typography-h3']['font-family']) && $elano_options['typography-h3']['font-family']!=''&& $elano_options['typography-h3']['font-weight']!='') { wp_enqueue_style('googlefont-h3', 'http://fonts.googleapis.com/css?family='.esc_attr($elano_options['typography-h3']['font-family'])); } if(isset($elano_options['typography-h4']['font-family']) && $elano_options['typography-h4']['font-family']!=''&& $elano_options['typography-h4']['font-weight']!='') { wp_enqueue_style('googlefont-h4', 'http://fonts.googleapis.com/css?family='.esc_attr($elano_options['typography-h4']['font-family'])); } if(isset($elano_options['typography-h5']['font-family']) && $elano_options['typography-h5']['font-family']!=''&& $elano_options['typography-h5']['font-weight']!='') { wp_enqueue_style('googlefont-h5', 'http://fonts.googleapis.com/css?family='.$elano_options['typography-h5']['font-family']); } if(isset($elano_options['typography-h6']['font-family']) && $elano_options['typography-h6']['font-family']!=''&& $elano_options['typography-h6']['font-weight']!='') { wp_enqueue_style('googlefont-h6', 'http://fonts.googleapis.com/css?family='.$elano_options['typography-h6']['font-family']); } // Enqueue all the theme CSS wp_enqueue_style('main', get_stylesheet_directory_uri().'/style.css'); wp_enqueue_style('bootstrap', get_template_directory_uri().'/assets/css/bootstrap.css'); wp_enqueue_style('bootstrap.min', get_template_directory_uri().'/assets/css/bootstrap.min.css'); wp_enqueue_style('style', get_template_directory_uri().'/assets/css/style.css'); wp_enqueue_style('responsive', get_template_directory_uri().'/assets/css/responsive.css'); wp_enqueue_style('font-awesome', get_template_directory_uri().'/assets/css/font/css/font-awesome.min.css'); wp_enqueue_style('font-awesome', get_template_directory_uri().'/assets/css/font/fonts/fontawesome-webfont.eot'); wp_enqueue_style('font-awesome', get_template_directory_uri().'/assets/css/font/css/fontawesome-webfont.svg'); wp_enqueue_style('font-awesome', get_template_directory_uri().'/assets/css/font/css/fontawesome-webfont.ttf'); wp_enqueue_style('font-awesome', get_template_directory_uri().'/assets/css/font/css/fontawesome-webfont.woff'); wp_enqueue_style('font-awesome', get_template_directory_uri().'/assets/css/font/css/FontAwesome.otf'); wp_enqueue_style('opensans-regular-webfont.eot', get_template_directory_uri().'/assets/css/font/fonts/opensans-regular-webfont.eot'); wp_enqueue_style('opensans-regular-webfont.svg', get_template_directory_uri().'/assets/css/font/fonts/opensans-regular-webfont.svg'); wp_enqueue_style('opensans-regular-webfont.ttf', get_template_directory_uri().'/assets/css/font/fonts/opensans-regular-webfont.ttf'); wp_enqueue_style('opensans-regular-webfont.woff', get_template_directory_uri().'/assets/css/font/fonts/opensans-regular-webfont.woff'); wp_enqueue_style('resize', get_template_directory_uri().'/assets/css/resize.css'); // Enqueue all the js files of theme wp_enqueue_script('jquery'); wp_enqueue_script('jquery.min', get_template_directory_uri().'/assets/js/jquery.min.js', array(), FALSE, TRUE); wp_enqueue_script('bootstrap', get_template_directory_uri().'/assets/js/bootstrap.js', array(), FALSE, TRUE); wp_enqueue_script('bootstrap.min', get_template_directory_uri().'/assets/js/bootstrap.min.js', array(), FALSE, TRUE); wp_enqueue_script('jquery.isotope', get_template_directory_uri().'/assets/js/jquery.isotope.js', array(), FALSE, TRUE); wp_enqueue_script('jquery.sticky', get_template_directory_uri().'/assets/js/jquery.sticky.js', array(), FALSE, TRUE); $inline_css=''; if(is_home()){ $pageid=get_option('page_for_posts'); } else { $pageid=get_the_ID(); } $inline_css.='.pagetitle .section-title h2{'; if($epcolor=get_post_meta( $pageid, 'elano_pagetitle_color',true)){ $inline_css.='color:'.$epcolor.' !important;'; } $inline_css.='} .pagetitle {'; if($epbgcolor=get_post_meta( $pageid, 'elano_pagetitle_bgcolor',true)){ $inline_css.='background-color:'.$epbgcolor.'!important;'; } if($epbgimage=get_post_meta( $pageid, 'elano_pagetitle_image',true)){ $inline_css.='background-image:url('.$epbgimage.')!important;'; } $inline_css.='}'; if(isset($elano_options['extra-css'])){ $inline_css.=$elano_options['extra-css']; } wp_add_inline_style( 'main', $inline_css ); $color_variation =''; if(isset($elano_options['custom_color']) && $elano_options['custom_color']!=''){ $hex = str_replace("#", "", esc_attr($elano_options['custom_color'])); if(strlen($hex) == 3) { $r = hexdec(substr($hex,0,1).substr($hex,0,1)); $g = hexdec(substr($hex,1,1).substr($hex,1,1)); $b = hexdec(substr($hex,2,1).substr($hex,2,1)); } else { $r = hexdec(substr($hex,0,2)); $g = hexdec(substr($hex,2,2)); $b = hexdec(substr($hex,4,2)); } $new_custom_color = array($r, $g, $b); $color_variation=' .navbar-default.style1 .navbar-nav > .open > a, .navbar-default.style1 .navbar-nav > .open > a:hover, .navbar-default.style1 .navbar-nav > .open > a:focus{color: #fff;} a, .pageXofY .pageX, .pricing .bestprice .name, .filter li a:hover, .widget ul li a:hover, #contacts a:hover, .title-color, .ms-staff-carousel .ms-staff-info h4, .filter li a:hover, .navbar-default .navbar-nav > .open > a, .navbar-default .navbar-nav > .open > a:hover, .navbar-default .navbar-nav > .open > a:focus, .navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus, a.go-about:hover, .text_color, .navbar-nav .dropdown-menu a:hover, .profile .profile-name, #elements h4, #contact li a:hover, #agency-slider h5, .ms-showcase1 .product-tt h3, .filter li a.active, .contacts li i, .big-icon i, .navbar-default.dark .navbar-brand:hover,.navbar-default.dark .navbar-brand:focus, a.p-button.border:hover, .navbar-default.default .navbar-nav > li > a.selected, .navbar-default.default .navbar-nav > li > a.selected:hover, .navbar-default.default .navbar-nav > li > a.selected, .navbar-default.default .navbar-nav > .open > a,.navbar-default.default .navbar-nav > .open > a:hover, .navbar-default.default .navbar-nav > .open > a:focus, .default .dropdown-menu > li > a:hover, .default .dropdown-menu > li > a:focus, .navbar-default.dark.default .dropdown-menu > li > a:hover, a.social:hover:before, .symbol.colored i, .icon-nofill, .slidecontent-bi .project-title-bi p a:hover, .grid .figcaption a.thumb-link:hover, .tp-caption a:hover, .btn-1d:hover, .btn-1d:active, #contacts .tweet_text a, #contacts .tweet_time a, .social-font-awesome li a:hover, h2.post-title a:hover, .tags a:hover, .btn-color span, #contacts .form-success p, .center-icon i, .cbp-l-filters-alignCenter .cbp-filter-item-active, .collapse-group .collapse-heading h4 a:hover, .collapse-group .collapse-heading h4 a, .social-icomoon a:hover, .team-details .team-position, .blog-nav a:hover, a:hover .text-inner, .cbp-l-filters-alignCenter .cbp-filter-item:hover, .btn-color{ color: '.esc_attr($elano_options['custom_color']).'; } a.sf-button.hide-icon, .tabs li.current, .readmore:hover, .navbar-default .navbar-nav > .open > a,.navbar-default .navbar-nav > .open > a:hover, .navbar-default .navbar-nav > .open > a:focus, a.p-button:hover, a.p-button.colored, .navbar-default.style1 .navbar-nav > li > a.selected, .light #contacts a.p-button, .tagcloud a:hover, .rounded.fill, .colored-section, .pricing .bestprice .price, .pricing .bestprice .signup, .signup:hover, .divider.colored, .services-graph li span, .no-touch .hi-icon-effect-1a .hi-icon:hover, .hi-icon-effect-1b .hi-icon:hover, .dropdown-menu > li > a:hover, .dropdown-menu > li > a:focus, .no-touch .hi-icon-effect-1b .hi-icon:hover, .symbol.colored .line-left, .symbol.colored .line-right, .projects-overlay #projects-loader, .panel-group .panel.active .panel-heading, .mail-box, .double-bounce1, .double-bounce2, .btn-color-1d:after, .container1 > div, .container2 > div, .container3 > div, .cbp-l-caption-buttonLeft:hover, .cbp-l-caption-buttonRight:hover, .btn-color:hover, .collapse-group .collapse-heading h4 a:hover .toggle-icon, .collapse-group .collapse-heading h4 a .toggle-icon, .hi-icon-effect-1 .hi-icon, .post-type, .blog-nav span, #back-top a:hover{ background-color:'.esc_attr($elano_options['custom_color']).'; } .blog-nav span, .blog-nav a:hover{border: 1px solid '.esc_attr($elano_options['custom_color']).';} .hi-icon-effect-1 .hi-icon:after{box-shadow: 0 0 0 1px '.esc_attr($elano_options['custom_color']).';} .colored-section:after {border: 20px solid '.esc_attr($elano_options['custom_color']).';} .filter li a.active, .filter li a:hover, .panel-group .panel.active .panel-heading{border:1px solid '.esc_attr($elano_options['custom_color']).'} a.p-button.colored:hover{background-color: '.esc_attr($elano_options['custom_color']).';} .navbar-default.default.border .navbar-nav > li > a.selected:before, .navbar-default.default.border .navbar-nav > li > a.selected:hover, .navbar-default.default.border .navbar-nav > li > a.selected{ border-bottom: 1px solid '.esc_attr($elano_options['custom_color']).'; } .bs-callout-theme-color { background-color: '.esc_attr($elano_options['custom_color']).'; border-color: '.esc_attr($elano_options['custom_color']).'; } .overlay-color, #featured-projects .cbp-caption:hover .cbp-caption-activeWrap, .cbp-caption-zoom .cbp-caption-activeWrap{ background-color: rgba('.$new_custom_color['0'].','.$new_custom_color['1'].','.$new_custom_color['2'].', 0.9); } .overlay-color.medium, .cbp-caption-minimal .cbp-caption-activeWrap, .skill-bar-percent, .post-content .featured-image a:hover .hover-image-blog{ background-color: rgba('.$new_custom_color['0'].','.$new_custom_color['1'].','.$new_custom_color['2'].', 0.80); } .triangle{border-left-color: '.esc_attr($elano_options['custom_color']).' !important;} .overlay-color.soft{ background-color: rgba('.$new_custom_color['0'].','.$new_custom_color['1'].','.$new_custom_color['2'].', 0.25); } .cbp-l-filters-alignCenter .cbp-filter-counter{ background: none repeat scroll 0 0 '.esc_attr($elano_options['custom_color']).'; border: 1px solid '.esc_attr($elano_options['custom_color']).'; } .cbp-l-filters-alignCenter .cbp-filter-counter:before{ border-top: 4px solid '.esc_attr($elano_options['custom_color']).'; } .btn-color, a:hover .text-inner{ border: 1px solid '.esc_attr($elano_options['custom_color']).'; } .appdesign .app-service:hover .icon-container .icon { background: '.esc_attr($elano_options['custom_color']).'; color: #ffffff; } .appdesign .app-service .icon-container .icon { border: 1px solid '.esc_attr($elano_options['custom_color']).'; color: '.esc_attr($elano_options['custom_color']).'; } .navbar-default .navbar-nav > li:hover > a::before, .navbar-default .navbar-nav > li.active > a::before { border-bottom-color: '.esc_attr($elano_options['custom_color']).'; } #ajax-div #loader, .loading-css, .cbp-loading, .cbp-popup-loadingBox, .nivo-lightbox-theme-default .nivo-lightbox-content.nivo-lightbox-loading{ border-right: 4px solid '.esc_attr($elano_options['custom_color']).'; border-top: 4px solid '.esc_attr($elano_options['custom_color']).'; } '; } wp_add_inline_style( 'elano-style-css', $color_variation ); } add_action('wp_enqueue_scripts', 'elano_load_theme_assets'); /********************************************************************* * RETINA SUPPORT */ add_filter('wp_generate_attachment_metadata', 'elano_retina_support_attachment_meta', 10, 2); function elano_retina_support_attachment_meta($metadata, $attachment_id) { // Create first image @2 elano_retina_support_create_images(get_attached_file($attachment_id), 0, 0, false); foreach ($metadata as $key => $value) { if (is_array($value)) { foreach ($value as $image => $attr) { if (is_array($attr)) elano_retina_support_create_images(get_attached_file($attachment_id), $attr['width'], $attr['height'], true); } } } return $metadata; } function elano_retina_support_create_images($file, $width, $height, $crop = false) { $resized_file = wp_get_image_editor($file); if (!is_wp_error($resized_file)) { if ($width || $height) { $filename = $resized_file->generate_filename($width . 'x' . $height . '@2x'); $resized_file->resize($width * 2, $height * 2, $crop); } else { $filename = str_replace('-@2x','@2x',$resized_file->generate_filename('@2x')); } $resized_file->save($filename); $info = $resized_file->get_size(); return array( 'file' => wp_basename($filename), 'width' => $info['width'], 'height' => $info['height'], ); } return false; } add_filter('delete_attachment', 'elano_delete_retina_support_images'); function elano_delete_retina_support_images($attachment_id) { $meta = wp_get_attachment_metadata($attachment_id); if(is_array($meta)){ $upload_dir = wp_upload_dir(); $path = pathinfo($meta['file']); // First image (without width-height specified $original_filename = $upload_dir['basedir'] . '/' . $path['dirname'] . '/' . wp_basename($meta['file']); $retina_filename = substr_replace($original_filename, '@2x.', strrpos($original_filename, '.'), strlen('.')); if (file_exists($retina_filename)) unlink($retina_filename); foreach ($meta as $key => $value) { if ('sizes' === $key) { foreach ($value as $sizes => $size) { $original_filename = $upload_dir['basedir'] . '/' . $path['dirname'] . '/' . $size['file']; $retina_filename = substr_replace($original_filename, '@2x.', strrpos($original_filename, '.'), strlen('.')); if (file_exists($retina_filename)) unlink($retina_filename); } } } } } // Enqueue comment-reply script if comments_open and singular function elano_enqueue_comment_reply() { if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'elano_enqueue_comment_reply' ); // Elano Pagination // Code taken from: http://wp-snippets.com/pagination-for-twitter-bootstrap/ function elano_pagination ($before = '', $after = '') { global $elano_options; echo $before; global $wpdb, $wp_query; $request = $wp_query->request; $posts_per_page = intval(get_query_var('posts_per_page')); $paged = intval(get_query_var('paged')); $numposts = $wp_query->found_posts; $max_page = $wp_query->max_num_pages; if ($numposts <= $posts_per_page) return; if (empty($paged) || $paged == 0) $paged = 1; $pages_to_show = 7; $pages_to_show_minus_1 = $pages_to_show - 1; $half_page_start = floor($pages_to_show_minus_1 / 2); $half_page_end = ceil($pages_to_show_minus_1 / 2); $start_page = $paged - $half_page_start; if ($start_page <= 0) $start_page = 1; $end_page = $paged + $half_page_end; if (($end_page - $start_page) != $pages_to_show_minus_1) { $end_page = $start_page + $pages_to_show_minus_1; } if ($end_page > $max_page) { $start_page = $max_page - $pages_to_show_minus_1; $end_page = $max_page; } if ($start_page <= 0) $start_page = 1; echo '
'; for ($i = $start_page; $i <= $end_page; $i++) { if ($i == $paged) echo ' ' . $i . ''; else echo ' ' . $i . ''; } echo '
'; echo $after; return; } /* Code for font-awesome support in Menu*/ add_action('wp_update_nav_menu_item', 'elano_nav_update',10, 3); function elano_nav_update($menu_id, $menu_item_db_id, $args ) { if (isset($_REQUEST['menu-item-faicon']) ) { $custom_faicon= $_REQUEST['menu-item-faicon'][$menu_item_db_id]; update_post_meta( $menu_item_db_id, '_menu_item_faicon', $custom_faicon); } } add_filter( 'wp_setup_nav_menu_item','elano_nav_item' ); function elano_nav_item($menu_item) { $menu_item->faicon = get_post_meta( $menu_item->ID, '_menu_item_faicon', true ); return $menu_item; } add_filter( 'wp_edit_nav_menu_walker', 'elano_nav_edit_walker',10,2 ); function elano_nav_edit_walker($walker,$menu_id) { return 'Walker_Nav_Menu_Edit_Custom'; } class Walker_Nav_Menu_Edit_Custom extends Walker_Nav_Menu { function start_el(&$output, $item, $depth = 0, $args = array(), $current_object_id = 0 ) { global $_wp_nav_menu_max_depth; $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; ob_start(); $item_id = esc_attr( $item->ID ); $removed_args = array( 'action', 'customlink-tab', 'edit-menu-item', 'menu-item', 'page-tab', '_wpnonce', ); $original_title = ''; if ( 'taxonomy' == $item->type ) { $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' ); if ( is_wp_error( $original_title ) ) $original_title = false; } elseif ( 'post_type' == $item->type ) { $original_object = get_post( $item->object_id ); $original_title = $original_object->post_title; } $classes = array( 'menu-item menu-item-depth-' . $depth, 'menu-item-' . esc_attr( $item->object ), 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive'), ); $title = $item->title; if ( ! empty( $item->_invalid ) ) { $classes[] = 'menu-item-invalid'; /* translators: %s: title of menu item which is invalid */ $title = sprintf( __( '%s (Invalid)','elano' ), $item->title ); } elseif ( isset( $item->post_status ) && 'draft' == $item->post_status ) { $classes[] = 'pending'; /* translators: %s: title of menu item in draft status */ $title = sprintf( __('%s (Pending)','elano'), $item->title ); } $title = empty( $item->label ) ? $title : $item->label; ?>