get( 'Version' ); if ( version_compare($the_theme_v, '1.3.9', ">=") ) { $obsolete_files = array("/inc/carousel.php","/inc/featurettes.php","/inc/highlights.php","/inc/ga.php","/inc/home-bak.php","/inc/jumbo.php","/archive.php","/image.php","/attachment.php","/author.php","/search.php","/sidebar-sidebar2.php"); foreach ( $obsolete_files as $obsolete_file ) { $theobsf = get_template_directory().$obsolete_file; if(file_exists($theobsf) ) unlink($theobsf); } } } add_action('init','eo_del_obsolete_files'); //require_once('library/shortcodes.php'); Shortcodes are disabled since they fall into 'plugin territory' //require_once('library/plugins.php'); // plugins & extra functions (optional) // Set content width if ( ! isset( $content_width ) ) $content_width = 580; /** * Creates a nicely formatted and more specific title element text * for output in head of document, based on current view. * * @param string $title Default title text for current view. * @param string $sep Optional separator. * * @return string Filtered title. * * @note may be called from http://example.com/wp-activate.php?key=xxx where the plugins are not loaded. */ function bones_filter_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', 'bonestheme' ), max( $paged, $page ) ); } return $title; } add_filter( 'wp_title', 'bones_filter_title', 10, 2 ); /************* THUMBNAIL SIZE OPTIONS *************/ // Thumbnail sizes add_image_size( 'eo-featurette', 350, 290, true ); add_image_size( 'eo-highlight', 140, 140, true); add_image_size( 'eo-carousel', 970, 360, true); /************* ACTIVE SIDEBARS ********************/ // Sidebars & Widgetizes Areas function bones_register_sidebars() { register_sidebar(array( 'id' => 'sidebar1', 'name' => 'Main Sidebar', 'description' => 'Used on every page.', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'id' => 'sidebar-2', 'name' => 'Home Sidebar', 'description' => 'Front page only.', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'id' => 'footer1', 'name' => 'Footer 1', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'id' => 'footer2', 'name' => 'Footer 2', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'id' => 'footer3', 'name' => 'Footer 3', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); /* to add more sidebars or widgetized areas, just copy and edit the above sidebar code. In order to call your new sidebar just use the following code: Just change the name to whatever your new sidebar's id is, for example: To call the sidebar in your template, you can just copy the sidebar.php file and rename it to your sidebar's name. So using the above example, it would be: sidebar-sidebar2.php */ } // don't remove this bracket! /************* COMMENT LAYOUT *********************/ // Comment Layout function bones_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?>
  • >
    %s', get_comment_author_link()) ?> ','') ?> comment_approved == '0') : ?>

    Login'; $args["reply_text"] = ' Reply'; $args["before"] = '
    '; $args["after"] = '
    '; ?> $depth, 'max_depth' => $args['max_depth']))) ?>
  •  
    '; return $form; } // don't remove this bracket! /****************** password protected post form *****/ add_filter( 'the_password_form', 'custom_password_form' ); function custom_password_form() { global $post; $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID ); $o = '
    ' . '

    ' . __( "This post is password protected. To view it please enter your password below:" ,'bonestheme') . '

    ' . '
    '; return $o; } /*********** update standard wp tag cloud widget so it looks better ************/ add_filter( 'widget_tag_cloud_args', 'my_widget_tag_cloud_args' ); function my_widget_tag_cloud_args( $args ) { $args['number'] = 20; // show less tags $args['largest'] = 9.75; // make largest and smallest the same - i don't like the varying font-size look $args['smallest'] = 9.75; $args['unit'] = 'px'; return $args; } // filter tag cloud output so that it can be styled by CSS function add_tag_class( $taglinks ) { $tags = explode('', $taglinks); $regex = "#(.*tag-link[-])(.*)(' title.*)#e"; $term_slug = "(get_tag($2) ? get_tag($2)->slug : get_category($2)->slug)"; foreach( $tags as $tag ) { $tagn[] = preg_replace($regex, "('$1$2 label tag-'.$term_slug.'$3')", $tag ); } $taglinks = implode('', $tagn); return $taglinks; } add_action( 'wp_tag_cloud', 'add_tag_class' ); add_filter( 'wp_tag_cloud','wp_tag_cloud_filter', 10, 2) ; function wp_tag_cloud_filter( $return, $args ) { return '
    ' . $return . '
    '; } // Enable shortcodes in widgets add_filter( 'widget_text', 'do_shortcode' ); // Disable jump in 'read more' link function remove_more_jump_link( $link ) { $offset = strpos($link, '#more-'); if ( $offset ) { $end = strpos( $link, '"',$offset ); } if ( $end ) { $link = substr_replace( $link, '', $offset, $end-$offset ); } return $link; } add_filter( 'the_content_more_link', 'remove_more_jump_link' ); // Remove height/width attributes on images so they can be responsive add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 ); add_filter( 'image_send_to_editor', 'remove_thumbnail_dimensions', 10 ); function remove_thumbnail_dimensions( $html ) { $html = preg_replace( '/(width|height)=\"\d*\"\s/', "", $html ); return $html; } // Add the Meta Box to the homepage template function add_homepage_meta_box() { global $post; // Only add homepage meta box if template being used is the homepage template // $post_id = isset($_GET['post']) ? $_GET['post'] : (isset($_POST['post_ID']) ? $_POST['post_ID'] : ""); $post_id = $post->ID; $template_file = get_post_meta($post_id,'_wp_page_template',TRUE); if ( $template_file == 'page-homepage.php' ){ add_meta_box( 'homepage_meta_box', // $id 'Optional Homepage Tagline', // $title 'show_homepage_meta_box', // $callback 'page', // $page 'normal', // $context 'high'); // $priority } } add_action( 'add_meta_boxes', 'add_homepage_meta_box' ); // Field Array $prefix = 'custom_'; $custom_meta_fields = array( array( 'label'=> 'Homepage tagline area', 'desc' => 'Displayed underneath page title. Only used on homepage template. HTML can be used.', 'id' => $prefix.'tagline', 'type' => 'textarea' ) ); // The Homepage Meta Box Callback function show_homepage_meta_box() { global $custom_meta_fields, $post; // Use nonce for verification wp_nonce_field( basename( __FILE__ ), 'wpbs_nonce' ); // Begin the field table and loop echo ''; foreach ( $custom_meta_fields as $field ) { // get value of this field if it exists for this post $meta = get_post_meta($post->ID, $field['id'], true); // begin a table row with echo ' aaa '; } // end foreach echo '
    '; switch($field['type']) { // text case 'text': echo '
    '.$field['desc'].''; break; // textarea case 'textarea': echo '
    '.$field['desc'].''; break; } //end switch echo '
    '; // end table } // Save the Data function save_homepage_meta( $post_id ) { global $custom_meta_fields; // verify nonce if ( !isset( $_POST['wpbs_nonce'] ) || !wp_verify_nonce($_POST['wpbs_nonce'], basename(__FILE__)) ) return $post_id; // check autosave if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id; // check permissions if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can( 'edit_page', $post_id ) ) return $post_id; } elseif ( !current_user_can( 'edit_post', $post_id ) ) { return $post_id; } // loop through fields and save the data foreach ( $custom_meta_fields as $field ) { $old = get_post_meta( $post_id, $field['id'], true ); $new = $_POST[$field['id']]; if ($new && $new != $old) { update_post_meta( $post_id, $field['id'], $new ); } elseif ( '' == $new && $old ) { delete_post_meta( $post_id, $field['id'], $old ); } } // end foreach } add_action( 'save_post', 'save_homepage_meta' ); // Add thumbnail class to thumbnail links function add_class_attachment_link( $html ) { $postid = get_the_ID(); $html = str_replace( ']+)?>/', '', $content, 1); } else { return $content; } } add_filter( 'the_content', 'eo_typo_format' ); function eo_gal_group( $content ){ global $post; $pattern = "/]*).(bmp|gif|jpeg|jpg|png|avi|mov|mp4|m4v)('|\")(.*?)>(.*?)<\/a>/i"; $replacement = '$7'; $content = preg_replace($pattern, $replacement, $content); return $content; } if( of_get_option( 'use_lightbox') == "1" ) add_filter( 'the_content', 'eo_gal_group', 11 ); add_editor_style('editor-style.css'); // Add Twitter Bootstrap's standard 'active' class name to the active nav link item add_filter('nav_menu_css_class', 'add_active_class', 10, 2 ); function add_active_class($classes, $item) { if( $item->menu_item_parent == 0 && in_array('current-menu-item', $classes) ) { $classes[] = "active"; } return $classes; } // enqueue styles function eo_theme_head() { global $eo_options; if( of_get_option( 'use_less') === "1" ) { // Have resources can be loaded less but chose regular css way // Less sources $less_rsrcs = of_get_option( 'use_less_for'); if( !empty($less_rsrcs) & is_array($less_rsrcs) ) { $less_rsrcs_arr = array(); foreach ( $less_rsrcs as $less_rsrc => $v) { if($v == "1") $less_rsrcs_arr[] = $less_rsrc; } //var_dump($less_rsrcs_arr); } if(in_array("bootstrap",$less_rsrcs_arr) ) echo ''; if(in_array("fontawesome",$less_rsrcs_arr) ) echo ''; /* array (size=4) 'bootstrap' => string '1' (length=1) 'fontawesome' => string '1' (length=1) 'example' => string '0' (length=1) 'some_other' => string '0' (length=1)*/ wp_register_script( 'less_js', get_template_directory_uri() . '/rsc/js/less.min.js', array(), '1.5.0', false ); wp_enqueue_script('less_js'); } else { //var_dump(of_get_option( 'load_bs_fe') ); // if( of_get_option( 'load_bs_fe') == "1" ) { ( of_get_option('use_bs_min_fe') == "1" ) ? $min = ".min" : $min = '' ; wp_register_style( 'bootstrap', get_template_directory_uri() . '/lib/bootstrap/css/bootstrap'.$min.'.css', array(), '3.0.1', 'all' ); wp_enqueue_style( 'bootstrap' ); // } } $use_bsw_theme = of_get_option( 'use_bsw_themes' ); $bsw_theme = of_get_option( 'bsw_theme' ); if( of_get_option( 'use_fontawesome') == "1" ) { // ( of_get_option('use_bs_min_css') == "1") ? $min = ".min" : $min = '' ; wp_register_style( 'fontawesome', get_template_directory_uri() . '/lib/font-awesome/css/font-awesome.min.css', array(), '1.0', 'all' ); wp_enqueue_style( 'fontawesome' ); } if( of_get_option( 'use_lightbox') == "1" ) { //( of_get_option('use_bs_min_css') == "1") ? $min = ".min" : $min = '' ; wp_register_style( 'colorbox', get_template_directory_uri() . '/lib/colorbox/colorbox.css', array(), '1.0', 'all' ); wp_enqueue_style( 'colorbox' ); } wp_register_style( 'bootstrap-ultimate', get_stylesheet_uri(), array(), '1.0', 'all' ); wp_enqueue_style( 'bootstrap-ultimate'); if( $use_bsw_theme && $use_bsw_theme != "default" ) { wp_register_style( 'bsw_theme', get_template_directory_uri() . '/panel/of/themes/' . $bsw_theme . '.css', array("bootstrap"), '1.0', 'all' ); wp_enqueue_style( 'bsw_theme' ); // Glyphicons get lost when using Bootswatch theme, you need to redefine them, not sure which is better for this fix: another http request or a few lines of ugly inline '; } function eo_inline_js_per_post(){ if(!is_singular()) return; global $post; $post_inline_js = get_post_meta($post->ID,'_eo_cust_post_js',true); if ( $post_inline_js && is_singular() ) { echo ''; } } add_action('wp_footer','eo_inline_js_per_post'); // Get theme options function inline_css_fe(){ global $eo_options; $gl_u = get_template_directory_uri().'/lib/bootstrap/fonts/'; $theme_options_styles = ''; if ( $eo_options["use_dropcaps"] == "1") { $theme_options_styles .= '.post_content p:first-child:first-letter {float: left; font-size: 3em; line-height: 2.4em; padding-top: 0.1em; padding-right: 0.2em; padding-left: 0.1em; }'; } if ( $eo_options["sticky_footer"] == "1") { $theme_options_styles .= 'html,body { height: 100%;} #wrap.stickyf { min-height: 100%; height: auto !important; height: 100%; margin: 0 auto -60px; padding: 0 0 60px;}'; } if(of_get_option('show_slider') == "1") $theme_options_styles .= '.navbar {margin-bottom: 0}'; if(of_get_option('use_bsw_themes') == "1") { /* bsw missing glyphicon fix */ $theme_options_styles .= '@font-face { font-family: "Glyphicons Halflings"; src: url("'.$gl_u.'glyphicons-halflings-regular.eot"); src: url("'.$gl_u.'glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"), url("'.$gl_u.'glyphicons-halflings-regular.woff") format("woff"), url("'.$gl_u.'glyphicons-halflings-regular.ttf") format("truetype"), url("'.$gl_u.'glyphicons-halflings-regular.svg#glyphicons-halflingsregular") format("svg"); }'; } if ( $eo_options['eo_typo_body'] ) { $typo_body = $eo_options['eo_typo_body']; if ( array_key_exists("source",$typo_body) && $typo_body["source"] == "gwf_font" ) { $theme_options_styles .= ' body{ font-family: "' .str_replace("+"," ",$typo_body['face'] ). '";'; } else { $theme_options_styles .= ' body{ font-family: ' .str_replace("+"," ",$typo_body['face'] ). ';'; } if ( array_key_exists("source",$typo_body) && $typo_body["source"] == "gwf_font" ) { $vrnt = $typo_body['variant']; ( preg_match('#[0-9]#',$vrnt) ) ? $fwe = preg_replace("/[^0-9]/", "",$vrnt) : $fwe = 'normal'; if ( strpos( $vrnt,"italic") !== false ) $theme_options_styles .= 'font-style: italic;'; $theme_options_styles .= 'font-weight: ' . $fwe. ';'; } if ( $typo_body["source"] == "os_font" ) $theme_options_styles .= 'font-weight: ' . $typo_body['style'] . ';'; if( ! empty($typo_body['color']) ) $theme_options_styles .= 'color: ' . $typo_body['color'] . ';'; if( ! empty($typo_body['size']) ) $theme_options_styles .= 'font-size: ' . $typo_body['size'] . ';'; $theme_options_styles .= '}'; } if ( $eo_options['eo_typo_heading'] ) { $typo_head = $eo_options['eo_typo_heading']; if ( array_key_exists("source",$typo_head) && $typo_head["source"] == "gwf_font" ) { $theme_options_styles .= ' h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a{ font-family: "' . str_replace("+"," ",$typo_head['face'] ). '";'; } else { $theme_options_styles .= ' h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, h1 a, h2 a, h3 a, h4 a, h5 a, h6 a{ font-family: ' . str_replace("+"," ",$typo_head['face'] ). ';'; } if ( array_key_exists("source",$typo_head) && $typo_head["source"] == "gwf_font" ) { $vrnt = $typo_head['variant']; ( preg_match('#[0-9]#',$vrnt) ) ? $fwe = preg_replace("/[^0-9]/", "",$vrnt) : $fwe = 'normal'; if ( strpos( $vrnt,"italic") !== false ) $theme_options_styles .= 'font-style: italic;'; $theme_options_styles .= 'font-weight: ' . $fwe. ';'; } if ( $typo_head["source"] == "os_font" ) $theme_options_styles .= 'font-weight: ' . $typo_head['style'] . ';'; if( ! empty($typo_head['color']) ) $theme_options_styles .= 'color: ' . $typo_head['color'] . ';'; // if( ! empty($typo_head['size']) ) $theme_options_styles .= 'font-size: ' . $typo_head['size'] . ';'; $theme_options_styles .= '}'; } if ( $eo_options['eo_typo_nav'] ) { $typo_nav = $eo_options['eo_typo_nav']; if ( array_key_exists("source",$typo_nav) && $typo_nav["source"] == "gwf_font" ) { $theme_options_styles .= ' .navbabbbr, .navbar-default .navbar-nav > li > a, .navbar-inverse .navbar-nav > li > a, .dropdown-menu > li > a{ font-family: "' . str_replace("+"," ",$typo_nav['face'] ). '";'; } else { $theme_options_styles .= ' .navbaaar, .navbar-default .navbar-nav > li > a, .navbar-inverse .navbar-nav > li > a, .dropdown-menu > li > a{ font-family: ' . str_replace("+"," ",$typo_nav['face'] ). ';'; } if ( array_key_exists("source",$typo_nav) && $typo_nav["source"] == "gwf_font" ) { $vrnt = $typo_nav['variant']; ( preg_match('#[0-9]#',$vrnt) ) ? $fwe = preg_replace("/[^0-9]/", "",$vrnt) : $fwe = 'normal'; if ( strpos( $vrnt,"italic") !== false ) $theme_options_styles .= 'font-style: italic;'; $theme_options_styles .= 'font-weight: ' . $fwe. ';'; } if ( $typo_nav["source"] == "os_font" ) $theme_options_styles .= 'font-weight: ' . $typo_nav['style'] . ';'; if( ! empty($typo_nav['color']) ) $theme_options_styles .= 'color: ' . $typo_nav['color'] . ';'; if( ! empty($typo_nav['size']) ) $theme_options_styles .= 'font-size: ' . $typo_nav['size'] . ';'; $theme_options_styles .= '}'; } // if ( $typo_body["source"] == "gwf_font" ) $theme_options_styles .= 'font-family: ' . $heading_typography['face'] . '; $link_color = of_get_option( 'link_color' ); if ($link_color) { $theme_options_styles .= ' a{ color: ' . $link_color . '; }'; } $link_hover_color = of_get_option( 'link_hover_color' ); if ($link_hover_color) { $theme_options_styles .= ' a:hover{ color: ' . $link_hover_color . '; }'; } $caru_of_prevent = of_get_option( 'caru_of_prevent' ); $caru_of_prevent_h = of_get_option( 'caru_of_prevent_h' ); if ($caru_of_prevent) { $theme_options_styles .= ' .carousel { overflow: hidden; max-height: ' . $caru_of_prevent_h . '; color: ' . $link_hover_color . '; }'; } $link_active_color = of_get_option( 'link_active_color' ); if ($link_active_color) { $theme_options_styles .= ' a:active{ color: ' . $link_active_color . '; }'; } $topbar_position = of_get_option( 'nav_position' ); if ($topbar_position == 'scroll') { $theme_options_styles .= ' .navbar{ position: static; } body{ padding-top: 0; } #content { padding-top: 27px; } ' ; } $topbar_bg_color = of_get_option( 'top_nav_bg_color' ); $use_gradient = of_get_option( 'showhidden_gradient' ); if ( $topbar_bg_color && !$use_gradient ) { $theme_options_styles .= ' #inner-header > .navbar { background-color: '. $topbar_bg_color . '; background-image: none; }' . $topbar_bg_color; } if ( $use_gradient ) { $topbar_bottom_gradient_color = of_get_option( 'top_nav_bottom_gradient_color' ); $theme_options_styles .= ' #inner-header > .navbar { background-image: -khtml-gradient(linear, left top, left bottom, from(' . $topbar_bg_color . '), to('. $topbar_bottom_gradient_color . ')); background-image: -moz-linear-gradient(top, ' . $topbar_bg_color . ', '. $topbar_bottom_gradient_color . '); background-image: -ms-linear-gradient(top, ' . $topbar_bg_color . ', '. $topbar_bottom_gradient_color . '); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, ' . $topbar_bg_color . '), color-stop(100%, '. $topbar_bottom_gradient_color . ')); background-image: -webkit-linear-gradient(top, ' . $topbar_bg_color . ', '. $topbar_bottom_gradient_color . '2); background-image: -o-linear-gradient(top, ' . $topbar_bg_color . ', '. $topbar_bottom_gradient_color . '); background-image: linear-gradient(top, ' . $topbar_bg_color . ', '. $topbar_bottom_gradient_color . '); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=\'' . $topbar_bg_color . '\', endColorstr=\''. $topbar_bottom_gradient_color . '2\', GradientType=0); }'; } else{ } $topbar_link_color = of_get_option( 'top_nav_link_color' ); if ( $topbar_link_color ) { $theme_options_styles .= ' .navbar .nav li a { color: '. $topbar_link_color . '; }'; } $topbar_link_hover_color = of_get_option( 'top_nav_link_hover_color' ); if ( $topbar_link_hover_color ) { $theme_options_styles .= ' .navbar .nav li a:hover { color: '. $topbar_link_hover_color . '; }'; } $topbar_dropdown_hover_bg_color = of_get_option( 'top_nav_dropdown_hover_bg' ); if ( $topbar_dropdown_hover_bg_color ) { $theme_options_styles .= ' .dropdown-menu li > a:hover, .dropdown-menu .active > a, .dropdown-menu .active > a:hover { background-color: ' . $topbar_dropdown_hover_bg_color . '; } '; } $topbar_dropdown_item_color = of_get_option( 'top_nav_dropdown_item' ); if ( $topbar_dropdown_item_color ){ $theme_options_styles .= ' .dropdown-menu a{ color: ' . $topbar_dropdown_item_color . ' !important; } '; } $jumbo_unit_bg_color = of_get_option( 'jumbo_bg_color' ); if ( $jumbo_unit_bg_color ) { $theme_options_styles .= ' .jumbotron { background-color: '. $jumbo_unit_bg_color . '; }'; } $suppress_comments_message = of_get_option( 'suppress_comments_message' ); if ( $suppress_comments_message ){ /* $theme_options_styles .= ' #main article { border-bottom: none; }'; _eo-check: what does this have to do with anything ?*/ } if(of_get_option('caru_eff') == "fade") { $theme_options_styles .= '.carousel .item { left: 0 !important; -webkit-transition: opacity .6s; /*adjust timing here */ -moz-transition: opacity .6s; -o-transition: opacity .6s; transition: opacity .6s; } .carousel .next.left, .carousel .prev.right { opacity: 1; z-index: 1; } .carousel .active.left, .carousel .active.right { opacity: 0; z-index: 2; }'; } $additional_css = of_get_option( 'eo_custom_css' ); if( $additional_css ){ $theme_options_styles .= $additional_css; } if( $theme_options_styles ){ echo ''; } $is_bs_test = isset($_REQUEST['bstest']); } // end get_wpbs_theme_options function add_action('wp_footer', 'eo_front_js'); function eo_front_js() { global $eo_options; ?> $gfw_family["family"], "variants" => $gfw_family["variants"], "lastMod" => $gfw_family["lastModified"], "subsets" => $gfw_family["subsets"] ); $gwf_face_variants[eo_sanitize_id($gfw_family["family"])] = $gfw_family["variants"]; // update the variant cache added in 1.3.9 set_transient( 'eo_gwf_variants', $gwf_face_variants, 60 * 1200 ); } $tfc = count($GWF_families); $google_font_src_arr = array( "font_src_slug" => "gwf_font", "font_src_name" => "Google Fonts", "font_faces" => $GWF_families ); $all_font_opt["gwf_font"] = $google_font_src_arr; // var_dump($google_font_src_arr); update_option( 'eo_googlefonts_arr', $google_font_src_arr ); update_option( 'eo_all_fonts_arr', $all_font_opt ); die('Success.Fonts updated. Total #'.$tfc.' fonts recieved, the page will be refreshed.'); } /* foreach ($json['items'] as $gf_item) { $family = $gf_item['family']; $family_slug = strtolower($gf_item['family']); $variants = $gf_item['variants']; $subsets = $gf_item['subsets']; $files = $gf_item['files']; $lastModified = $gf_item['lastModified']; // var_dump($json); }*/ } //echo $result; } } add_action("wp_ajax_eo_get_gwf_variant", "eo_get_gwf_variant"); function eo_get_gwf_variant($ftg = NULL) { // _eo-todo: add nonce check // We should have Google fonts one way or another // var_dump($ftg); $eo_fnts_prep = get_option ( 'eo_all_fonts_arr' ); $def_gf_opt = get_option ( 'eo_def_gf_array' ); if ( ! empty($eo_fnts_prep) && is_array($eo_fnts_prep) ) { //it's ok. } else if ( ! empty($def_gf_opt) && is_array($def_gf_opt) ) { $eo_fnts_prep = $def_gf_opt; } else { die("No Google Fonts found ! #eo_err_code: 71"); } if ( isset($_POST["font_to_get"]) ) { // Advent%2BPro if(strpos($_POST["font_to_get"],"+") !== false) { $font_to_get = strtolower(str_replace("+","_",$_POST["font_to_get"]) ); } else if(strpos($_POST["font_to_get"],"%2B") !== false) { $font_to_get = strtolower(str_replace("%2B","_",$_POST["font_to_get"]) ); } else { $font_to_get = strtolower($_POST["font_to_get"]); } } else if ( isset($ftg) ) { $font_to_get = strtolower(str_replace("+","_",$ftg) ); } else { // die("["regular"]"); } $face_trans = get_transient( 'eo_gwf_variants'); if($face_trans) { // delete_transient( 'eo_comb_faces_trans'); $gwf_face_variants = $face_trans; // var_dump($gwf_face_variants); $eo_all_fonts_arr = get_option( 'eo_all_fonts_arr' ); $eo_googlefonts_arr = get_option( 'eo_googlefonts_arr' ); // var_dump("eo_googlefonts_arr
    "); // var_dump($eo_googlefonts_arr); } else { $eo_googlefonts_arr = get_option( 'eo_googlefonts_arr' ); if($eo_googlefonts_arr) { $eo_googlefonts_array = $eo_googlefonts_arr["font_faces"]; $gwf_face_variants = array(); foreach ( $eo_googlefonts_array as $fslug =>$gwf_face ) { $gwf_face_variants[$fslug] = $gwf_face["variants"]; } } else { $gwf_faces = $eo_fnts_prep["gwf_font"]["font_faces"]; $gwf_face_variants = array(); foreach ( $gwf_faces as $fslug =>$gwf_face ) { $gwf_face_variants[$fslug] = $gwf_face["variants"]; } /// $face_variants = $eo_fnts_prep["gwf_font"]["font_faces"][$font_to_get]; // save the restructured array for later use for a short time - 120 mins } set_transient( 'eo_gwf_variants', $gwf_face_variants, 60 * 1200 ); //var_dump($gwf_face_variants); } // var_dump($gwf_face_variants); $fvar_ret = $gwf_face_variants[$font_to_get]; // Return for php or die for ajax. if ( isset($_POST["font_to_get"]) ) { // _eo-todo: bugfix; multiple word families variants not loading online, but loading in localhost... Advent+Pro if( ! isset($fvar_ret) ) $fvar_ret = array("regular"); die( json_encode($fvar_ret)); } else if ( isset($ftg) ) { return $fvar_ret; } } function get_bsw_theme () { } function eo_get_bsw_theme() { die("disabled"); } /** * Add "has-submenu" CSS class to navigation menu items that have children in a * submenu. */ function nav_menu_item_parent_classing( $classes, $item ) { global $wpdb; $has_children = $wpdb -> get_var( "SELECT COUNT(meta_id) FROM {$wpdb->prefix}postmeta WHERE meta_key='_menu_item_menu_item_parent' AND meta_value='" . $item->ID . "'" ); if ( $has_children > 0 ) { array_push( $classes, "dropdown" ); } return $classes; } add_filter( "nav_menu_css_class", "nav_menu_item_parent_classing", 10, 2 ); // _eo custom wp page menu since default doesnt support ul class for bootstrap function eo_wp_page_menu( $args = array() ) { $defaults = array('sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => ''); $args = wp_parse_args( $args, $defaults ); $args = apply_filters( 'wp_page_menu_args', $args ); $menu = ''; $list_args = $args; // var_dump($args); // Show Home in the menu if ( ! empty($args['show_home']) ) { if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] ) $text = __('Home'); else $text = $args['show_home']; $class = ''; if ( is_front_page() && !is_paged() ) $class = 'class="current_page_item active"'; $menu .= '
  • ' . $args['link_before'] . $text . $args['link_after'] . '
  • '; // If the front page is a page, add it to the exclude list if (get_option('show_on_front') == 'page') { if ( !empty( $list_args['exclude'] ) ) { $list_args['exclude'] .= ','; } else { $list_args['exclude'] = ''; } $list_args['exclude'] .= get_option('page_on_front'); } } $list_args['echo'] = false; $list_args['title_li'] = ''; $list_args['walker'] = new eo_Walker_Page(); $menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args) ); //var_dump($menu); if ( $menu ) $menu = ''; $menu = '
    ' . $menu . "
    \n"; $menu = apply_filters( 'wp_page_menu', $menu, $args ); if ( $args['echo'] ) echo $menu; else return $menu; } function eo_main_nav_fallback() { eo_wp_page_menu( array( 'show_home' => true, 'menu_class' => 'top-nav clearfix navfback', // adding custom nav class 'ul_class' => 'nav navbar-nav ', // adding custom nav class // 'include' => 9999, // 'show_home' => true, 'exclude' => '', 'echo' => true, 'link_before' => '', // before each link 'link_after' => '' // after each link ) ); } add_action( 'admin_bar_menu', 'eo_theme_admin_toolbar_menu', 999 ); function eo_theme_admin_toolbar_menu( $wp_admin_bar ) { global $theme_slug, $theme_sname; if(!$theme_slug) $theme_slug = 'options-framework'; $args = array( 'id' => 'bsul_aml', 'title' => $theme_sname .' Settings', $url = admin_url( 'themes.php?page='.$theme_slug ), 'href' => $url, 'meta' => array( 'class' => 'bsul-theme-opt' ) ); $wp_admin_bar->add_node( $args ); } if( array_key_exists("loop_whtd",$eo_options) ) add_action( 'pre_get_posts', 'eo_query_modif' ); function eo_query_modif( $query ) { global $eo_options; $wtd = $eo_options['loop_whtd']; if(! empty($wtd) && $query->is_main_query() && !is_admin() && ! is_singular() && ! is_404()) { $my_post_type = get_query_var( 'post_type' ); //var_dump($my_post_type); if ( empty( $my_post_type ) ) { $types = array(); foreach ( $wtd as $typ => $v) { if($v == "1") $types[] = $typ; } if(empty($types)) $types = array("post"); if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { if( is_woocommerce() || is_cart() || is_checkout() ) $types = array("product"); } //var_dump($less_rsrcs_arr); $args = array( 'exclude_from_search' => false, 'public' => true, '_builtin' => false ); $output = 'names'; $operator = 'and'; //$post_types = array_merge( $post_types, array( 'post' ) ); $query->set( 'post_type', $types ); } /* if ( ! empty( $eo_options["loop_excl"] ) ) { $excluded_ids = array(); $loop_excludes = $eo_options["loop_excl"]; var_dump($loop_excludes); foreach ( $loop_excludes as $exc=>$v) { if( $exc == "allmod" ) { foreach ( $loop_excludes as $exc=>$v) { ${$exc . '_ids'} = get_transient('eo_'.$exc.'_ids'); if(${$exc . '_ids'} && is_array(${$exc . '_ids'}) ) $excluded_ids = array_merge($excluded_ids,${$exc . '_ids'} ); } } else { // if is home or page and if the module is enabled $home_mods = array("high"=>'show_highlights',"caru"=>'show_slider',"feat"=>'show_featurettes'); if($v == "1" && is_home() && $eo_options[$home_mods[$exc]] || $v == "1" && is_page() && !empty($eo_options[$exc.'_also_disp']) & is_array($eo_options[$exc.'_also_disp']) && $eo_options[$exc.'_also_disp'][$post->ID] == "1") { ${$exc . '_ids'} = get_transient('eo_'.$exc.'_ids'); if(${$exc . '_ids'} && is_array(${$exc . '_ids'}) ) $excluded_ids = array_merge($excluded_ids,${$exc . '_ids'} ); // var_dump($excluded_ids); } } } $excluded_ids = array_unique($excluded_ids); $query->set( 'post__not_in', $excluded_ids ); }*/ } } function eo_post_clses($classes) { global $post; if( post_password_required($post->ID) ) { $classes[] = "alert alert-warning"; } return $classes; } add_filter('post_class', 'eo_post_clses'); /* TODO LIST _eo-todo: code-cleanup _eo-todo: Sort Google fonts by -last modified/updated- _eo-todo: Pinned posts _eo-todo: Backgrounds -Subtle Patterns - ? _eo_todo: Option to enable / disable widgets per page get_option('sidebars_widgets') _eo-todo: Reorganize options _eo-todo: Stackable / dismissable options _eo-todo: Validation & sanity & dependancy checks for options _eo-todo: Fix crash on adding new groups? _eo-todo: Dismiss blocks in admin. ? _eo-todo: Extended font support for Cufon, FontSquirrel etc. ? _eo-todo: make left side menu drag & drop sortable ? _eo-todo: Debug options for the end user ? _eo-todo: Better docs ? _eo-todo: Look for / build a child theme repository like Bootswatch ? _eo-todo: Check font selects for no-js DONE LIST _eo-todo: bugfix; multiple word families variants not loading online, but loading in localhost... Advent+Pro _eo-todo: Options Import / Export ? _eo-todo: adjustable layout - main-sidebar colum widths, multiple sidebar _eo-todo: Dismissable help / alerts _eo-done: mobile select menu _eo-done: fontawesome menus _eo-done: chosen disabled - font variant select conflict _eo-done: [Shortcodes] - Not allowed in themes. _eo-done: Update Google Font function for php-free js-only since WP doesnt allow */ ?>