Willkommen bei WordPress. Dies ist dein erster Beitrag. Bearbeite oder lösche ihn und beginne mit dem Schreiben!
Hallo Welt!
von raredesign | Dez 3, 2019 | Allgemein | 0 Kommentare
Cokiee Shell
Current Path : /var/www/web284/html/wp-content/themes/splendor_theme/ |
Current File : //var/www/web284/html/wp-content/themes/splendor_theme/functions.php |
<?php require_once ('admin/index.php'); include('inc/shortcodes.php'); add_filter( 'woocommerce_breadcrumb_defaults', 'jk_change_breadcrumb_delimiter' ); function jk_change_breadcrumb_delimiter( $defaults ) { // Change the breadcrumb delimeter from '/' to '>' $defaults['delimiter'] = ' › '; return $defaults; } add_filter('widget_text', 'do_shortcode'); /*======================================= Add WP Breadcrumbs =======================================*/ function kama_breadcrumbs( $sep='<div class="subpage_breadcrumbs_dv"> › </div>', $term=false, $taxonomies=false ){ global $post, $wp_query, $wp_post_types; if (!isset ($out)) {$out = '';} if (!isset ($pg_term_start)) {$pg_term_start = '';} if (!isset ($pg_end)) {$pg_end = '';} $l = (object) array( 'home' => __('Home','commander') ,'paged' => __('Page %s','commander') ,'p404' => __('Error 404','commander') ,'search' => __('Search Result','commander') ,'author' => __('Author Archive: <b>%s</b>','commander') ,'year' => __('Archive for <b>%s</b> year','commander') ,'month' => __('Archive for: <b>%s</b>','commander') ,'attachment' => __('Mediz: %s','commander') ,'tag' => __('Filter by: <b>%s</b>','commander') ,'tax_tag' => __('%s from "%s" by tag: <b>%s</b>','commander') ); if( $paged = $wp_query->query_vars['paged'] ){ $pg_patt = '<a class="subpage_block" href="%s">'; $pg_end = '</a>'. $sep . sprintf($l->paged, $paged); } if( is_front_page() ) return print ($paged?sprintf($pg_patt, get_bloginfo('url')):'') . $l->home . $pg_end; if( is_404() ) $out = $l->p404; elseif( is_search() ){ //$s = preg_replace('@<script@i', '<script>alert("THIS IS SPARTA!!!111"); location="http://lleo.aha.ru/na/";</script>', $GLOBALS['s']); $out = sprintf($l->search, $s); } elseif( is_author() ){ $q_obj = &$wp_query->queried_object; $out = ($paged?sprintf( $pg_patt, get_author_posts_url($q_obj->ID, $q_obj->user_nicename) ):'') . sprintf($l->author, $q_obj->display_name) . $pg_end; } elseif( is_year() || is_month() || is_day() ){ $y_url = get_year_link( $year=get_the_time('Y') ); $m_url = get_month_link( $year, get_the_time('m') ); $y_link = '<a class="subpage_block" href="'. $y_url .'">'. $year .'</a>'; $m_link = '<a class="subpage_block" href="'. $m_url .'">'. get_the_time('F') .'</a>'; if( is_year() ) $out = ($paged?sprintf($pg_patt, $y_url):'') . sprintf($l->year, $year) . $pg_end; elseif( is_month() ) @$out = $y_link . $sep . ($paged?sprintf($pg_patt, $m_url):'') . sprintf($l->month, get_the_time('F')) . $pg_end; elseif( is_day() ) $out = $y_link . $sep . $m_link . $sep . get_the_time('l'); } elseif( $wp_post_types[$post->post_type]->hierarchical ){ $parent = $post->post_parent; $crumbs=array(); while($parent){ $page = &get_post($parent); $crumbs[] = '<a class="subpage_block" href="'. get_permalink($page->ID) .'" title="">'. $page->post_title .'</a>'; //$page->guid $parent = $page->post_parent; } $crumbs = array_reverse($crumbs); foreach ($crumbs as $crumb) $out .= $crumb.$sep; @$out = $out.$post->post_title; } else { if(!$term){ if( is_single() ){ if( !$taxonomies ){ $taxonomies = get_taxonomies( array('hierarchical'=>true, 'public'=>true) ); if( count($taxonomies)==1 ) $taxonomies = 'category'; } if( $term = get_the_terms( $post->post_parent?$post->post_parent:$post->ID, $taxonomies ) ) $term = array_shift($term); } else $term = $wp_query->get_queried_object(); } if( !$term && !is_attachment() ) return print "Error: Taxonomy isn`t defined!"; if( is_attachment() ){ if(!$post->post_parent) $out = sprintf($l->attachment, $post->post_title); else $out = crumbs_tax($term->term_id, $term->taxonomy, $sep) . "<a class='subpage_block' href='". get_permalink($post->post_parent) ."'>". get_the_title($post->post_parent) ."</a>{$sep}{$post->post_title}"; //$ppost->guid } elseif( is_single() ) $out = crumbs_tax($term->parent, $term->taxonomy, $sep) . "<a class='subpage_block' href='". get_term_link( (int)$term->term_id, $term->taxonomy ) ."'>{$term->name}</a>{$sep}{$post->post_title}"; elseif( !is_taxonomy_hierarchical($term->taxonomy) ){ if( is_tag() ) $out = $pg_term_start . sprintf($l->tag, $term->name) . $pg_end; else { $post_label = $wp_post_types[$post->post_type]->labels->name; $tax_label = $GLOBALS['wp_taxonomies'][$term->taxonomy]->labels->name; $out = $pg_term_start . sprintf($l->tax_tag, $post_label, $tax_label, $term->name) . $pg_end; } } else @$out = crumbs_tax($term->parent, $term->taxonomy, $sep) . $pg_term_start . $term->name . $pg_end; } $home = '<a class="subpage_block" href="'. get_bloginfo('url') .'">'. $l->home .'</a>' . $sep; return print $home . $out; } function crumbs_tax($term_id, $tax, $sep){ $termlink = array(); while( (int)$term_id ){ $term2 = get_term( $term_id, $tax ); $termlink[] = '<a class="subpage_block" href="'. get_term_link( (int)$term2->term_id, $term2->taxonomy ) .'">'. $term2->name .'</a>'. $sep; $term_id = (int)$term2->parent; } $termlinks = array_reverse($termlink); return implode('', $termlinks); } include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); if (is_plugin_active('js_composer/js_composer.php')){ include('vc_extend/vc.php'); } /* ------------------------------------------------------------------------ */ /* Enqueue Stylesheets */ /* ------------------------------------------------------------------------ */ //DISABLE WOOCOMMERCE PRETTY PHOTO SCRIPTS add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 ); function my_deregister_javascript() { wp_deregister_script( 'prettyPhoto' ); wp_deregister_script( 'prettyPhoto-init' ); } //DISABLE WOOCOMMERCE PRETTY PHOTO STYLE add_action( 'wp_print_styles', 'my_deregister_styles', 100 ); function my_deregister_styles() { wp_deregister_style( 'woocommerce_prettyPhoto_css' ); } load_theme_textdomain( 'builder', get_template_directory() . '/languages' ); function wp_corenavi() { global $wp_query, $wp_rewrite; $pages = ''; $max = $wp_query->max_num_pages; if (!$current = get_query_var('paged')) $current = 1; $a['base'] = ($wp_rewrite->using_permalinks()) ? user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' ) : @add_query_arg('paged','%#%'); if( !empty($wp_query->query_vars['s']) ) $a['add_args'] = array( 's' => get_query_var( 's' ) ); $a['total'] = $max; $a['current'] = $current; $total = 1; $a['mid_size'] = '3'; $a['end_size'] = '1'; $a['prev_text'] = 'Back'; $a['next_text'] = 'Next'; $a['total'] = $wp_query->max_num_pages; echo paginate_links($a); } function theme_styles_basic() { /* ------------------------------------------------------------------------ */ /* Register Stylesheets */ /* ------------------------------------------------------------------------ */ wp_register_style( 'wide_layout', get_template_directory_uri() . '/assets/css/wide_layout.css', array(), '1', 'all' ); wp_register_style( 'oi_prettyPhoto_css', get_template_directory_uri() . '/assets/css/prettyPhoto.css', array(), '1', 'all' ); wp_enqueue_style( 'oi_prettyPhoto_css' ); wp_register_style( 'oi_panzer_css', get_template_directory_uri() . '/assets/css/panzer.css', array(), '1', 'all' ); wp_enqueue_style( 'oi_panzer_css' ); wp_register_style( 'oi_bxslider_css', get_template_directory_uri() . '/assets/css/jquery.bxslider.css', array(), '1', 'all' ); wp_enqueue_style( 'oi_bxslider_css' ); /* ------------------------------------------------------------------------ */ /* Enqueue Stylesheets */ /* ------------------------------------------------------------------------ */ global $smof_data; if ($smof_data['responsiveon'] == true) { } wp_enqueue_style( 'stylesheet', get_stylesheet_uri(), array(), '1', 'all' ); // Main Stylesheet if (($smof_data['theme_layout'] == "Boxed and 1170px container") || ($smof_data['theme_layout'] == "Fullwidth and 1170px container")) { wp_enqueue_style( 'wide_layout' ); } } add_action( 'wp_enqueue_scripts', 'theme_styles_basic', 1 ); /* ------------------------------------------------------------------------ */ /* Loading Google Fonts */ /* ------------------------------------------------------------------------ */ function load_fonts() { global $smof_data; $myfont = array('Arial','Verdana, Geneva','Trebuchet','Georgia','Times New Roman','Tahoma, Geneva','Palatino','Helvetica','arial'); if ($smof_data['header_one'] == true && !in_array($smof_data['menu_font'],$myfont)){ $font = array($smof_data['menu_font']); }elseif ($smof_data['header_two'] == true && !in_array($smof_data['h2_menu_font'],$myfont)){ $font = array($smof_data['h2_menu_font']); }elseif ($smof_data['header_three'] == true && !in_array($smof_data['h3_menu_font'],$myfont)){ $font = array($smof_data['h3_menu_font']); }elseif ($smof_data['header_four'] == true && !in_array($smof_data['h4_menu_font'],$myfont)){ $font = array($smof_data['h4_menu_font']); }; foreach($smof_data as $v){ if(is_array($v) && isset($v['face']) && !in_array($v['face'],$myfont)) $font[]=$v['face']; } $fox_font = array_unique($font); foreach($fox_font as $v){ wp_register_style(urlencode($v), 'http://fonts.googleapis.com/css?family='. urlencode($v).':300,400,400italic,700,700italic&subset=latin,greek-ext,cyrillic,latin-ext,greek,cyrillic-ext,vietnamese'); wp_enqueue_style(urlencode($v)); } } add_action('wp_head', 'load_fonts'); /* ------------------------------------------------------------------------ */ /* Loading Theme Scripts */ /* ------------------------------------------------------------------------ */ add_action('wp_enqueue_scripts', 'sp_load_scripts'); if ( !function_exists( 'sp_load_scripts' ) ) { function sp_load_scripts() { wp_enqueue_script( 'jquery' ); wp_enqueue_script('sp_nicescroll', get_template_directory_uri().'/assets/js/jquery.nicescroll.min.js', false, null , true); wp_enqueue_script('sp_modernizr', get_template_directory_uri().'/assets/js/modernizr.custom.js', false, null , true); wp_enqueue_script('sp_dlmenu', get_template_directory_uri().'/assets/js/jquery.dlmenu.js', false, null , true); wp_enqueue_script('sp_tweeter', get_template_directory_uri().'/assets/js/jquery.tweet.js', false, null , true); wp_enqueue_script('sp_waypoints', get_template_directory_uri().'/assets/js/waypoints.min.js', false, null , true); wp_enqueue_script('sp_bootstrap', get_template_directory_uri().'/assets/js/bootstrap.min.js', false, null , true); wp_enqueue_script('sp_retina', get_template_directory_uri().'/assets/js/retina-1.1.0.min.js', false, null , true); wp_enqueue_script('sp_st', get_template_directory_uri().'/assets/js/st.js', false, null , true); wp_enqueue_script('sp_jsui', get_template_directory_uri().'/assets/js/jquery.waitforimages.js', false, null , true); wp_enqueue_script('sp_waitforimages', get_template_directory_uri().'/assets/js/jquery-ui-1.10.3.custom.min.js', false, null , true); wp_enqueue_script('sp_isotope', get_template_directory_uri().'/assets/js/jquery.isotope.min.js', false, null , true); wp_enqueue_script('sp_prettyPhoto', get_template_directory_uri().'/assets/js/jquery.prettyPhoto.js', false, null , true); wp_enqueue_script('sp_audio', get_template_directory_uri().'/assets/js/audiojs/audio.min.js', false, null , true); wp_enqueue_script('sp_nivo', get_template_directory_uri().'/assets/js/jquery.nivo.slider.js', false, null , true); wp_enqueue_script('sp_flickr', get_template_directory_uri().'/assets/js/jflickrfeed.min.js', false, null , true); wp_enqueue_script('sp_testimonialrotator', get_template_directory_uri().'/assets/js/testimonialrotator.js', false, null , true); wp_enqueue_script('sp_bxslider', get_template_directory_uri().'/assets/js/jquery.bxslider.min.js', false, null , true); wp_enqueue_script('sp_custom', get_template_directory_uri().'/assets/js/custom.js', false, null , true); } } /* ------------------------------------------------------------------------ */ /* Loading Theme Menu */ /* ------------------------------------------------------------------------ */ function oi_menu() { register_nav_menus( array( 'main_menu' => 'Main Navigation', 'secondary_menu' => 'Footer Navigation' ) ); } add_action( 'init', 'oi_menu' ); class My_Walker extends Walker_Nav_Menu { function start_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<div class='my_drop'><ul class='sub-menu'>\n"; } function end_lvl( &$output, $depth = 0, $args = array() ) { $indent = str_repeat("\t", $depth); $output .= "$indent</ul></div>\n"; } function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { global $wp_query; $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) ); $class_names = ' class="' . esc_attr( $class_names ) . ' menu-item-'. $item->ID . '"'; $output .= $indent . '<li id="menu-item-id-'. $item->ID . '"' . $value . $class_names .' >'; $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : ''; $item_output = $args->before; $item_output .= '<a'. $attributes .' data-description="' . $item->description . '">'; $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; $item_output .= '</a>'; $item_output .= $args->after; $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } } /*======================================= // Add Widgets =======================================*/ include("framework/widgets/oi-flickr-widget.php"); // Extra Fields add_action('admin_init', 'extra_fields', 1); function extra_fields() { add_meta_box( 'extra_fields', 'Additional settings', 'extra_fields_box_page_func', 'page', 'normal', 'high' ); add_meta_box( 'extra_fields', 'Additional settings', 'extra_fields_box_port_func', 'portfolio-type', 'normal', 'high' ); } function extra_fields_box_port_func( $post ){ ?> <h4>Few words about project</h4> <p> <input type="text" name="extra[port-descr]" style="width:100%;" value="<?php echo get_post_meta($post->ID, 'port-descr', 1); ?>"> </input> </p> <div style="clear:both"></div> <div style="height:10px;"></div> <h4>Choose Portfolio Style</h4> <?php $of_portfolio_details_style = array("1" => "Landscape Style", "2" => "Portrait Style", "3" => "With Right Sidebar", "4" => "With Left Sidebar"); ?> <select name="extra[port-det-style]"> <?php foreach ($of_portfolio_details_style as $val => $name){ ?> <option <?php if ($name == get_post_meta($post->ID, 'port-det-style', 1)) { echo 'selected';} ?> value="<?php echo $name ?>"><?php echo $name ?></option> <?php } ?> </select> <div style="clear:both"></div> <div style="height:20px;"></div> <h4>You can upload up to 10 additional images (Optional. For slider)</h4> <div style="width:50%; float:left"> <p> <label for="upload_image">Image 1: </label> <input id="upload_image" type="text" style="width:70%;" name="extra[image]" value="<?php echo get_post_meta($post->ID, image, true); ?>" /> <input class="upload_image_button" type="button" value="Upload" /><br/> </p> <input type="hidden" name="extra_fields_nonce" value="<?php echo wp_create_nonce(__FILE__); ?>" /> <p> <label for="upload_image">Image 2: </label> <input id="upload_image" type="text" style="width:70%;" name="extra[image2]" value="<?php echo get_post_meta($post->ID, image2, true); ?>" /> <input class="upload_image_button" type="button" value="Upload" /><br/> </p> <input type="hidden" name="extra_fields_nonce" value="<?php echo wp_create_nonce(__FILE__); ?>" /> <p> <label for="upload_image">Image 3: </label> <input id="upload_image" type="text" style="width:70%;" name="extra[image3]" value="<?php echo get_post_meta($post->ID, image3, true); ?>" /> <input class="upload_image_button" type="button" value="Upload" /><br/> </p> <p> <label for="upload_image">Image 4: </label> <input id="upload_image" type="text" style="width:70%;" name="extra[image4]" value="<?php echo get_post_meta($post->ID, image4, true); ?>" /> <input class="upload_image_button" type="button" value="Upload" /><br/> </p> <p> <label for="upload_image">Image 5: </label> <input id="upload_image" type="text" style="width:70%;"name="extra[image5]" value="<?php echo get_post_meta($post->ID, image5, true); ?>" /> <input class="upload_image_button" type="button" value="Upload" /><br/> </p> </div> <div style="width:50%; float:left"> <p> <label for="upload_image">Image 6: </label> <input id="upload_image" type="text" style="width:70%;" name="extra[image6]" value="<?php echo get_post_meta($post->ID, image6, true); ?>" /> <input class="upload_image_button" type="button" value="Upload" /><br/> </p> <input type="hidden" name="extra_fields_nonce" value="<?php echo wp_create_nonce(__FILE__); ?>" /> <p> <label for="upload_image">Image 7: </label> <input id="upload_image" type="text" style="width:70%;" name="extra[image7]" value="<?php echo get_post_meta($post->ID, image7, true); ?>" /> <input class="upload_image_button" type="button" value="Upload" /><br/> </p> <input type="hidden" name="extra_fields_nonce" value="<?php echo wp_create_nonce(__FILE__); ?>" /> <p> <label for="upload_image">Image 8: </label> <input id="upload_image" type="text" style="width:70%;" name="extra[image8]" value="<?php echo get_post_meta($post->ID, image8, true); ?>" /> <input class="upload_image_button" type="button" value="Upload" /><br/> </p> <p> <label for="upload_image">Image 9: </label> <input id="upload_image" type="text" style="width:70%;" name="extra[image9]" value="<?php echo get_post_meta($post->ID, image9, true); ?>" /> <input class="upload_image_button" type="button" value="Upload" /><br/> </p> <p> <label for="upload_image">Image 10: </label> <input id="upload_image" type="text" style="width:69%;" name="extra[image10]" value="<?php echo get_post_meta($post->ID, image10, true); ?>" /> <input class="upload_image_button" type="button" value="Upload" /><br/> </p> </div> <div style="clear:both"></div> <div style="height:20px;"></div> <div style="width:50%"> <h4>You can upload up to 4 additional images (Optional. For Gallery)</h4> <p> <label for="upload_image">Image 1: </label> <input id="upload_image" type="text" style="width:70%;" name="extra[image_g_1]" value="<?php echo get_post_meta($post->ID, image_g_1, true); ?>" /> <input class="upload_image_button" type="button" value="Upload" /><br/> </p> <input type="hidden" name="extra_fields_nonce" value="<?php echo wp_create_nonce(__FILE__); ?>" /> <p> <label for="upload_image">Image 2: </label> <input id="upload_image" type="text" style="width:70%;" name="extra[image_g_2]" value="<?php echo get_post_meta($post->ID, image_g_2, true); ?>" /> <input class="upload_image_button" type="button" value="Upload" /><br/> </p> <input type="hidden" name="extra_fields_nonce" value="<?php echo wp_create_nonce(__FILE__); ?>" /> <p> <label for="upload_image">Image 3: </label> <input id="upload_image" type="text" style="width:70%;" name="extra[image_g_3]" value="<?php echo get_post_meta($post->ID, image_g_3, true); ?>" /> <input class="upload_image_button" type="button" value="Upload" /><br/> </p> <p> <label for="upload_image">Image 4: </label> <input id="upload_image" type="text" style="width:70%;" name="extra[image_g_4]" value="<?php echo get_post_meta($post->ID, image_g_4, true); ?>" /> <input class="upload_image_button" type="button" value="Upload" /><br/> </p> </div> <div style="clear:both"></div> <div style="height:20px;"></div ><input type="hidden" name="extra_fields_nonce" value="<?php echo wp_create_nonce(__FILE__); ?>" /> <h4>Or past code for Video (iframe height="360" width="100%" )</h4> <p> <textarea type="text" name="extra[video]" style="width:100%;height:50px;"><?php echo get_post_meta($post->ID, 'video', 1); ?></textarea> </p> <?php } function extra_fields_box_page_func( $post ){ ?> <h4>You can use any sidebar, just choose it</h4> <?php global $wp_registered_sidebars; ?> <select name="extra[sidebarss]"> <?php foreach ($wp_registered_sidebars as $val){ ?> <option <?php if ($val['name'] == get_post_meta($post->ID, 'sidebarss', 1)) { echo 'selected';} ?> value="<?php echo $val['name'] ?>"><?php echo $val['name'] ?></option> <?php } ?> </select> <br> <h4>Choose Category (Only For Portfolio Category Template)</h4> <select name="extra[pcats]"> <?php $categories = get_categories(array('type' => 'post', 'taxonomy' => 'portfolio-category')); foreach($categories as $category) { $group = $category->slug; $val['name'] = $category->cat_name; ?> <option <?php if ($val['name'] == get_post_meta($post->ID, 'pcats', 1)) { echo 'selected';} ?> value="<?php echo $val['name'] ?>"><?php echo $val['name'] ?></option> <?php } ?> </select> <?php } add_action('save_post', 'extra_fields_update', 0); function extra_fields_update( $post_id ){ if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return false; if ( !current_user_can('edit_post', $post_id) ) return false; if( !isset($_POST['extra']) ) return false; $_POST['extra'] = array_map('trim', $_POST['extra']); foreach( $_POST['extra'] as $key=>$value ){ if( empty($value) ) delete_post_meta($post_id, $key); update_post_meta($post_id, $key, $value); } return $post_id; } function upload_scripts() { wp_enqueue_script('media-upload'); wp_enqueue_script('thickbox'); wp_register_script('my-upload', get_template_directory_uri().'/assets/js/custom_uploader.js', array('jquery','media-upload','thickbox')); wp_enqueue_script('my-upload'); } function upload_styles() { wp_enqueue_style('thickbox'); } add_action('admin_print_scripts', 'upload_scripts'); add_action('admin_print_styles', 'upload_styles'); function change_page_menu_classes($menu){ global $post; if (get_post_type($post) == 'portfolio-type') { $menu = str_replace( 'current_page_parent', '', $menu ); // remove all current_page_parent classes $menu = str_replace( 'portfolio_item', 'portfolio_item current_page_parent', $menu ); // add the current_page_parent class to the page you want } return $menu; } add_filter( 'wp_nav_menu', 'change_page_menu_classes', 0 ); if ( ! isset( $content_width ) ) $content_width = 1170; /*======================================= Register Sidebar UNLIMITED (c) FoxSash http://themeforest.net/user/FoxSash =======================================*/ global $smof_data; $kk = $smof_data['page_sidebar_generator']; if ( function_exists('register_sidebar') ){ register_sidebar(array( 'name' => 'Blog Sidebar', 'before_widget' => '<div class="well">', 'after_widget' => '</div>', 'before_title' => '<h6 style="text-transform: uppercase !important; font-weight:600 !important; margin-bottom:0px;">', 'after_title' => '</h6><hr style="margin-bottom:8px;">', )); register_sidebar(array( 'name' => 'Shop Sidebar', 'before_widget' => '<div class="well">', 'after_widget' => '</div>', 'before_title' => '<h6 style="text-transform: uppercase !important; font-weight:600 !important; margin-bottom:0px;">', 'after_title' => '</h6><hr style="margin-bottom:8px;">', )); register_sidebar(array( 'name' => 'Portfolio Sidebar', 'before_widget' => '<div class="well">', 'after_widget' => '</div>', 'before_title' => '<h6 style="text-transform: uppercase !important; font-weight:600 !important; margin-bottom:0px !important;">', 'after_title' => '</h6><hr style="margin-bottom:8px;">', )); register_sidebar(array( 'name' => 'Footer', 'before_widget' => '<div class="span3">', 'after_widget' => '</div>', 'before_title' => '<h6 style="text-transform: uppercase !important;">', 'after_title' => '</h6>', )); register_sidebar(array( 'name' => 'Right Sidebar', 'before_widget' => '<div class="well">', 'after_widget' => '</div>', 'before_title' => '<h5 style="text-transform: uppercase !important; font-weight:600 !important; margin-bottom:0px !important; ">', 'after_title' => '</h5><hr>', )); register_sidebar(array( 'name' => 'Left Sidebar', 'before_widget' => '<div class="well">', 'after_widget' => '</div>', 'before_title' => '<h5 style="text-transform: uppercase !important; font-weight:600 !important; margin-bottom:0px !important;">', 'after_title' => '</h5><hr>', )); register_sidebar(array( 'name' => 'Shop', 'before_widget' => '<div class="well">', 'after_widget' => '</div>', 'before_title' => '<h6 style="text-transform: uppercase !important; font-weight:600 !important; margin-bottom:0px;">', 'after_title' => '</h6><hr style="margin-bottom:8px;">', )); for($i=0;$i<=$kk;$i++){ register_sidebar(array( 'name' => 'Page Left Sidebar '.$i, 'before_widget' => '<div class="page_sidebar"><div style="padding-right:10px; margin-right:12px !important;"><div class="well">', 'after_widget' => '</div></div></div>', 'before_title' => '<h6 style="text-transform: uppercase !important; font-weight:600 !important; margin-bottom:0px !important;">', 'after_title' => '</h6><hr>', )); register_sidebar(array( 'name' => 'Page Right Sidebar '.$i, 'before_widget' => '<div class="well">', 'after_widget' => '</div>', 'before_title' => '<h6 style="text-transform: uppercase !important; font-weight:600 !important; margin-bottom:0px;">', 'after_title' => '</h6><hr style="margin-bottom:8px;">', )); }} add_theme_support( 'post-formats', // post formats array( 'gallery', // gallery of images 'link', // quick link to other site 'quote', // a quick quote 'video', // video 'audio', // audio ) ); /* ------------------------------------------------------------------------ */ /* Automatic Plugin Activation */ require_once('framework/plugin-activation.php'); add_action('tgmpa_register', 'goodchoice_register_required_plugins'); function goodchoice_register_required_plugins() { $plugins = array( array( 'name' => 'Visual Composer', // The plugin name 'slug' => 'js_composer', // The plugin slug (typically the folder name) 'source' => get_template_directory_uri() . '/framework/plugins/js_composer.zip', // The plugin source 'required' => false, // If false, the plugin is only 'recommended' instead of required 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch 'force_deactivation' => true, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins 'external_url' => '', // If set, overrides default API URL and points to an external URL ), array( 'name' => 'Slider Revolution', // The plugin name 'slug' => 'revslider', // The plugin slug (typically the folder name) 'source' => get_template_directory_uri() . '/framework/plugins/revslider.zip', // The plugin source 'required' => false, // If false, the plugin is only 'recommended' instead of required 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch 'force_deactivation' => true, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins 'external_url' => '', // If set, overrides default API URL and points to an external URL ), array( 'name' => 'Custom Registration', // The plugin name 'slug' => 'custom-wp-login-widget', // The plugin slug (typically the folder name) 'source' => get_template_directory_uri() . '/framework/plugins/custom-wp-login-widget.zip', // The plugin source 'required' => false, // If false, the plugin is only 'recommended' instead of required 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch 'force_deactivation' => true, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins 'external_url' => '', // If set, overrides default API URL and points to an external URL ), array( 'name' => 'Post Types Order', // The plugin name 'slug' => 'post-types-order', // The plugin slug (typically the folder name) 'source' => get_template_directory_uri() . '/framework/plugins/post-types-order.zip', // The plugin source 'required' => false, // If false, the plugin is only 'recommended' instead of required 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch 'force_deactivation' => false, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins 'external_url' => '', // If set, overrides default API URL and points to an external URL ), array( 'name' => 'CF-Post-Formats', // The plugin name 'slug' => 'cf-post-formats', // The plugin slug (typically the folder name) 'source' => get_template_directory_uri() . '/framework/plugins/cf-post-formats.zip', // The plugin source 'required' => false, // If false, the plugin is only 'recommended' instead of required 'version' => '', // E.g. 1.0.0. If set, the active plugin must be this version or higher, otherwise a notice is presented 'force_activation' => false, // If true, plugin is activated upon theme activation and cannot be deactivated until theme switch 'force_deactivation' => true, // If true, plugin is deactivated upon theme switch, useful for theme-specific plugins 'external_url' => '', // If set, overrides default API URL and points to an external URL ), ); // Change this to your theme text domain, used for internationalising strings $theme_text_domain = 'goodchoice-framework'; /** * Array of configuration settings. Amend each line as needed. * If you want the default strings to be available under your own theme domain, * leave the strings uncommented. * Some of the strings are added into a sprintf, so see the comments at the * end of each line for what each argument will be. */ $config = array( 'domain' => $theme_text_domain, // Text domain - likely want to be the same as your theme. 'default_path' => '', // Default absolute path to pre-packaged plugins 'parent_menu_slug' => 'themes.php', // Default parent menu slug 'parent_url_slug' => 'themes.php', // Default parent URL slug 'menu' => 'install-required-plugins', // Menu slug 'has_notices' => true, // Show admin notices or not 'is_automatic' => true, // Automatically activate plugins after installation or not 'message' => '', // Message to output right before the plugins table 'strings' => array( 'page_title' => __( 'Install Required Plugins', $theme_text_domain ), 'menu_title' => __( 'Install Plugins', $theme_text_domain ), 'installing' => __( 'Installing Plugin: %s', $theme_text_domain ), // %1$s = plugin name 'oops' => __( 'Something went wrong with the plugin API.', $theme_text_domain ), 'notice_can_install_required' => _n_noop( 'This theme requires the following plugin: %1$s.', 'This theme requires the following plugins: %1$s.' ), // %1$s = plugin name(s) 'notice_can_install_recommended' => _n_noop( 'This theme recommends the following plugin: %1$s.', 'This theme recommends the following plugins: %1$s.' ), // %1$s = plugin name(s) 'notice_cannot_install' => _n_noop( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'Sorry, but you do not have the correct permissions to install the %s plugins. Contact the administrator of this site for help on getting the plugins installed.' ), // %1$s = plugin name(s) 'notice_can_activate_required' => _n_noop( 'The following required plugin is currently inactive: %1$s.', 'The following required plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s) 'notice_can_activate_recommended' => _n_noop( 'The following recommended plugin is currently inactive: %1$s.', 'The following recommended plugins are currently inactive: %1$s.' ), // %1$s = plugin name(s) 'notice_cannot_activate' => _n_noop( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'Sorry, but you do not have the correct permissions to activate the %s plugins. Contact the administrator of this site for help on getting the plugins activated.' ), // %1$s = plugin name(s) 'notice_ask_to_update' => _n_noop( 'The following plugin needs to be updated to its latest version to ensure maximum compatibility with this theme: %1$s.', 'The following plugins need to be updated to their latest version to ensure maximum compatibility with this theme: %1$s.' ), // %1$s = plugin name(s) 'notice_cannot_update' => _n_noop( 'Sorry, but you do not have the correct permissions to update the %s plugin. Contact the administrator of this site for help on getting the plugin updated.', 'Sorry, but you do not have the correct permissions to update the %s plugins. Contact the administrator of this site for help on getting the plugins updated.' ), // %1$s = plugin name(s) 'install_link' => _n_noop( 'Begin installing plugin', 'Begin installing plugins' ), 'activate_link' => _n_noop( 'Activate installed plugin', 'Activate installed plugins' ), 'return' => __( 'Return to Required Plugins Installer', $theme_text_domain ), 'plugin_activated' => __( 'Plugin activated successfully.', $theme_text_domain ), 'complete' => __( 'All plugins installed and activated successfully. %s', $theme_text_domain ), // %1$s = dashboard link 'nag_type' => 'updated' // Determines admin notice type - can only be 'updated' or 'error' ) ); tgmpa($plugins, $config); } function custom_excerpt_length( $length ) { return 24; } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); /*======================================= Add Thumbnail Support =======================================*/ add_theme_support( 'automatic-feed-links' ); add_theme_support('post-thumbnails'); if ( function_exists('add_theme_support') ) { add_theme_support('post-thumbnails'); } /*======================================= woocommerce =======================================*/ remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10); add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10); function my_theme_wrapper_start() { echo '<section id="main">'; } function my_theme_wrapper_end() { echo '</section>'; } add_theme_support( 'woocommerce' ); // Lets create the function to house our form function woocommerce_catalog_page_ordering() { ?> <?php } // now we set our cookie if we need to function dl_sort_by_page($count) { if (isset($_COOKIE['shop_pageResults'])) { // if normal page load with cookie $count = $_COOKIE['shop_pageResults']; } if (isset($_GET['woocommerce-sort-by-columns'])) { //if form submitted setcookie('shop_pageResults', $_GET['woocommerce-sort-by-columns'], time()+1209600, '/', 'beadsnwire.lukeseall.co.uk/', false); //this will fail if any part of page has been output- hope this works! $count = $_GET['woocommerce-sort-by-columns']; } // else normal page load and no cookie return $count; } add_filter('loop_shop_per_page','dl_sort_by_page'); add_action( 'woocommerce_before_shop_loop', 'woocommerce_catalog_page_ordering', 20 ); /** * Custom Add To Cart Messages * Add this to your theme functions.php file **/ function my_cart_messages($message) { $newmessage = 'Veiw Cart'; $replacemessage = '<a$1class="btn btn-small btn-danger" style="float:right; margin-top:-3px !important;">' . $newmessage .'</a>'; $message = preg_replace('#<a(.*?)class="button">(.*?)</a>#', $replacemessage, $message); return $message; } add_filter( 'woocommerce_add_to_cart_message', 'my_cart_messages', 99); /** * Custom WooCommerce widgets **/ add_action( 'widgets_init', 'override_woocommerce_widgets', 15 ); function override_woocommerce_widgets() { // Ensure our parent class exists to avoid fatal error (thanks Wilgert!) if ( class_exists( 'WC_Widget_Price_Filter' ) ) { unregister_widget( 'WC_Widget_Price_Filter' ); include_once( 'framework/widgets/oi_widget_price_filter.php' ); register_widget( 'Custom_WC_Widget_Price_Filter' ); } if ( class_exists( 'WC_Widget_Cart' ) ) { unregister_widget( 'WC_Widget_Cart' ); include_once( 'framework/widgets/oi_widget_cart.php' ); register_widget( 'Custom_WC_Widget_Cart' ); } } add_filter('get_search_form', 'my_search_form'); function my_search_form($text) { $text = str_replace('<input type="submit" id="searchsubmit" value="Search" />', '<button type="submit" class="btn"><i class="icon-search"></i></button>', $text); return $text; } function mytheme_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; ?> <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>"> <div class="seppp"> <?php if ($comment->comment_approved == '0') : ?> <div class="alert alert-info"><?php echo 'Your comment is awaiting moderation.'; ?></div> <?php endif; ?> <!-- <h3 class="no-indent"><?php comment_author_link(); ?></h3> --> <div> <div class="blog_item_comments_description"> <div class="hidden-phone" style="float:left; margin-right:0px;"> <?php echo get_avatar($comment,$size='50'); ?> </div> <h6 style="margin-bottom:4px;">By <span class="colored"><?php comment_author_link(); ?></span> <a style="color:inherit; padding-left:7px;" href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">/ <?php echo get_comment_date('d M Y') ?></a> / <?php comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])), $comment->comment_ID) ?> </h6> <hr style="margin-top:0px; margin-bottom:10px;"> <div style=" font-style:italic;"> <?php comment_text() ?> </div> </div> </div> </div> <?php } add_filter('woocommerce_sale_flash', 'woo_custom_hide_sales_flash'); function woo_custom_hide_sales_flash() { ?> <div class="sp_flash"> </div> <?php } /** * Check if WooCommerce is active **/ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { /** * Localisation (with WPML support) **/ add_action( 'init', 'plugin_init' ); function plugin_init() { load_plugin_textdomain( 'woocommerce-new-badge', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); } /** * New Badge class **/ if ( ! class_exists( 'WC_nb' ) ) { class WC_nb { public function __construct() { add_action( 'wp_enqueue_scripts', 'sp_load_scripts' ); // Enqueue the styles add_action( 'woocommerce_before_shop_loop_item_title', array( $this, 'woocommerce_show_product_loop_new_badge' ), 30 ); // The new badge function // Init settings $this->settings = array( array( 'name' => __( 'New Badge', 'woocommerce-new-badge' ), 'type' => 'title', 'id' => 'wc_nb_options' ), array( 'name' => __( 'Product Newness', 'woocommerce-new-badge' ), 'desc' => __( "Display the 'New' flash for how many days?", 'woocommerce-new-badge' ), 'id' => 'wc_nb_newness', 'type' => 'number', ), array( 'type' => 'sectionend', 'id' => 'wc_nb_options' ), ); // Default options add_option( 'wc_nb_newness', '30' ); // Admin add_action( 'woocommerce_settings_image_options_after', array( $this, 'admin_settings' ), 20); add_action( 'woocommerce_update_options_catalog', array( $this, 'save_admin_settings' ) ); } /*-----------------------------------------------------------------------------------*/ /* Class Functions */ /*-----------------------------------------------------------------------------------*/ // Load the settings function admin_settings() { woocommerce_admin_fields( $this->settings ); } // Save the settings function save_admin_settings() { woocommerce_update_options( $this->settings ); } /*-----------------------------------------------------------------------------------*/ /* Frontend Functions */ /*-----------------------------------------------------------------------------------*/ // Display the new badge function woocommerce_show_product_loop_new_badge() { $postdate = get_the_time( 'Y-m-d' ); // Post date $postdatestamp = strtotime( $postdate ); // Timestamped post date $newness = get_option( 'wc_nb_newness' ); // Newness in days as defined by option if ( ( time() - ( 60 * 60 * 24 * 1 ) ) < $postdatestamp ) { // If the product was published within the newness time frame display the new badge echo '<div class="sp_new-badge"></div>'; } } } $WC_nb = new WC_nb(); } } // Переменные и умная длина цитаты. function print_excerpt($length) { // Максимальная длина цитаты. Длина задается в символах global $post; $text = $post->post_excerpt; if ( '' == $text ) { $text = get_the_content(''); $text = apply_filters('the_content', $text); $text = str_replace(']]>', ']]>', $text); } $text = strip_shortcodes($text); // опционально, рекомендуется $text = strip_tags($text); // используйте' $text = strip_tags($text,'<p><a>'); ' если хотите оставить некоторые теги $text = substr($text,0,$length); $excerpt = reverse_strrchr($text, '.', 1); if( $excerpt ) { echo apply_filters('the_excerpt',$excerpt); } else { echo apply_filters('the_excerpt',$text); } } function reverse_strrchr($haystack, $needle, $trail) { return strrpos($haystack, $needle) ? substr($haystack, 0, strrpos($haystack, $needle) + $trail) : false; } // Rewrite avatar class add_filter('get_avatar','change_avatar_css'); function change_avatar_css($class) { $class = str_replace("class='avatar", "class='avatar img-polaroid ", $class) ; return $class; } // CUSTOM POSTS PER PAGE function portfolio_posts_per_page($query) { global $smof_data; if (isset($query->query_vars['post_type']) && $query->query_vars['post_type'] == 'portfolio-type' ){ $query->query_vars['posts_per_page'] =$smof_data['sl_portfolio_projects']; } return $query; } if ( !is_admin() ) add_filter( 'pre_get_posts', 'portfolio_posts_per_page' ); // CUSTOM POST TYPES function justins_custom_post_types() { // Portfolio $labels_portfolio = array( 'add_new' => 'Add New', 'portfolio-type', 'add_new_item' => 'Add New Portfolio Post', 'edit_item' => 'Edit Portfolio Post', 'menu_name' => 'Portfolio', 'name' => 'Portfolio', 'post type general name', 'new_item' => 'New Portfolio Post', 'not_found' => 'No portfolio posts found', 'not_found_in_trash' => 'No portfolio posts found in Trash', 'parent_item_colon' => '', 'singular_name' => 'Portfolio Post', 'post type singular name', 'search_items' => 'Search Portfolio Posts', 'view_item' => 'View Portfolio Post', ); $args_portfolio = array( 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => true, 'labels' => $labels_portfolio, 'menu_position' => 4, 'public' => true, 'publicly_queryable' => true, 'query_var' => true, 'show_in_menu' => true, 'show_ui' => true, 'supports' => array( 'comments', 'editor', 'excerpt', 'thumbnail', 'title' ), 'singular_label' => 'Portfolio', ); register_post_type( 'portfolio-type', $args_portfolio ); } add_action( 'init', 'justins_custom_post_types' ); // CUSTOM TAXONOMIES function justins_custom_taxonomies() { // Portfolio Categories $labels = array( 'add_new_item' => 'Add New Category', 'all_items' => 'All Categories' , 'edit_item' => 'Edit Category' , 'name' => 'Portfolio Categories', 'taxonomy general name' , 'new_item_name' => 'New Genre Category' , 'menu_name' => 'Categories' , 'parent_item' => 'Parent Category' , 'parent_item_colon' => 'Parent Category:', 'singular_name' => 'Portfolio Category', 'taxonomy singular name' , 'search_items' => 'Search Categories' , 'update_item' => 'Update Category' , ); register_taxonomy( 'portfolio-category', array( 'portfolio-type' ), array( 'hierarchical' => true, 'labels' => $labels, 'query_var' => true, 'rewrite' => array( 'slug' => 'portfolio-type/category' ), 'show_ui' => true, )); // Portfolio Tags $labels = array( 'add_new_item' => 'Add New Tag' , 'all_items' => 'All Tags' , 'edit_item' => 'Edit Tag' , 'menu_name' => 'Portfolio Tags' , 'name' => 'Portfolio Tags', 'taxonomy general name' , 'new_item_name' => 'New Genre Tag' , 'parent_item' => 'Parent Tag' , 'parent_item_colon' => 'Parent Tag:' , 'singular_name' => 'Portfolio Tag', 'taxonomy singular name' , 'search_items' => 'Search Tags' , 'update_item' => 'Update Tag' , ); register_taxonomy( 'portfolio-tags', array( 'portfolio-type' ), array( 'hierarchical' => true, 'labels' => $labels, 'query_var' => true, 'rewrite' => array( 'slug' => 'portfolio-type/tag' ), 'show_ui' => true, )); } add_action( 'init', 'justins_custom_taxonomies', 0 ); function my_login_logo() { global $smof_data; ?> <style type="text/css"> body.login div#login h1 a { background-image: url(<?php echo stripslashes($smof_data['header_logo']) ?>); background-size:auto; } </style> <?php } add_action( 'login_enqueue_scripts', 'my_login_logo' ); function my_login_stylesheet() { ?> <link rel="stylesheet" id="custom_wp_admin_css" href="<?php echo get_template_directory_uri() . '/assets/css/style-login.css'; ?>" type="text/css" media="all" /> <?php } add_action( 'login_enqueue_scripts', 'my_login_stylesheet' ); add_filter( 'login_headerurl', 'custom_loginlogo_url' ); function custom_loginlogo_url($url) { return home_url(); } // Your own login logo title text function isacustom_wp_login_title() { return get_bloginfo('name'); } add_filter('login_headertitle', 'isacustom_wp_login_title'); ?>
Cokiee Shell Web 1.0, Coded By Razor
Neueste Kommentare