Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // theme admin
- include('functions/theme-admin.php');
- //Remove WordPress Version For Security Reasons
- remove_action('wp_head', 'wp_generator');
- // get scripts
- add_action('wp_enqueue_scripts','my_theme_scripts_function');
- function my_theme_scripts_function() {
- wp_deregister_script('jquery');
- wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"), false, '');
- wp_enqueue_script('jquery');
- }
- if ( !is_admin() ) {
- function my_init_method() {
- wp_deregister_script( 'l10n' );
- }
- add_action('init', 'my_init_method');
- }
- add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
- function my_deregister_javascript() {
- if (is_front_page() || is_archive() || is_page()) {
- wp_deregister_script( 'lightbox' );
- wp_deregister_script( 'stt-common' );
- wp_deregister_script( 'jquerylazyload' );
- wp_deregister_script( 'jquery' );
- }
- }
- function control_wp_script_versioning($src)
- {
- $src = remove_query_arg( 'ver', $src );
- return $src;
- }
- function control_wp_style_versioning($src)
- {
- $src = remove_query_arg( 'ver', $src );
- return $src;
- }
- add_filter('script_loader_src', 'control_wp_script_versioning', 15);
- add_filter('style_loader_src', 'control_wp_style_versioning', 15);
- function new_excerpt_length($length) {
- return 20;
- }
- add_filter('excerpt_length', 'new_excerpt_length');
- //Replace Excerpt Link
- function new_excerpt_more($more) {
- global $post;
- return '...';
- }
- add_filter('excerpt_more', 'new_excerpt_more');
- if ( function_exists( 'add_theme_support' ) )
- add_theme_support( 'post-thumbnails' );
- // featured image sizes
- if ( function_exists( 'add_image_size' ) ) {
- add_image_size( 'shadows-full-size', 9999, 9999, false );
- add_image_size( 'shadows-post-image', 140, 140, true );
- add_image_size( 'shadows-single-image', 140, 140, true );
- add_image_size( 'shadows-related-image', 190, 130, true );
- add_image_size( 'shadows-featured-image', 230, 120, true );
- }
- // Enable Custom Background
- add_custom_background();
- // Register Navigation Menus
- register_nav_menus(
- array(
- 'primary'=>__('Menu'),
- )
- );
- //Register Sidebars
- if ( function_exists('register_sidebar') )
- register_sidebar(array(
- 'name' => 'ستون کناری',
- 'before_widget' => '<div class="sidebar-box">',
- 'after_widget' => '</div>',
- 'before_title' => '<h4>',
- 'after_title' => '</h4>',
- ));
- if ( function_exists('register_sidebar') )
- register_sidebar(array(
- 'name' => 'فوتر ۱',
- 'before_widget' => '<div class="footer-box">',
- 'after_widget' => '</div>',
- 'before_title' => '<h4>',
- 'after_title' => '</h4>',
- ));
- if ( function_exists('register_sidebar') )
- register_sidebar(array(
- 'name' => 'فوتر ۲',
- 'before_widget' => '<div class="footer-box">',
- 'after_widget' => '</div>',
- 'before_title' => '<h4>',
- 'after_title' => '</h4>',
- ));
- if ( function_exists('register_sidebar') )
- register_sidebar(array(
- 'name' => 'فوتر ۳',
- 'before_widget' => '<div class="footer-box">',
- 'after_widget' => '</div>',
- 'before_title' => '<h4>',
- 'after_title' => '</h4>',
- ));
- if ( function_exists('register_sidebar') )
- register_sidebar(array(
- 'name' => 'فوتر ۴',
- 'description' => 'Widgets in this area will be shown in the footer - right side.',
- 'before_widget' => '<div class="footer-box">',
- 'after_widget' => '</div>',
- 'before_title' => '<h4>',
- 'after_title' => '</h4>',
- ));
- define('EDD_SLUG', 'product');
- add_filter('widget_text', 'do_shortcode');
- // This is used for top menu
- register_nav_menus( array(
- 'top_menu' => __( 'Top Menu', 'your_theme_name' )
- ) );
- /**
- * Modifies submenu li
- */
- add_filter('wpmenucart_submenu_items', 'mod_wpmenucart_submenu_item_li', 1, 1);
- function mod_wpmenucart_submenu_item_li($wpmenucart_submenu_items){
- global $wpMenuCart;
- $submenu_data = $wpMenuCart->shop->submenu_items();
- $cart_submenu_item_li = '';
- foreach ( $submenu_data as $submenu_item_data ) {
- // Format submenu item content (without permalink or li yet!)
- // The thumbnail
- $cart_submenu_item_content = '<span class="wpmenucart-thumbnail">'.$submenu_item_data['item_thumbnail'].'</span>';
- // Item info wrapper
- $cart_submenu_item_content .= '<span class="wpmenucart-order-item-info">';
- // Product Name
- // strip out / truncate $item_name
- if (strlen($submenu_item_data['item_name']) > apply_filters( 'wpmenucart_submenu_name_truncate', '20') ) {
- $submenu_item_data['item_name'] = $submenu_item_data['item_name'];
- }
- $cart_submenu_item_content .= '<span class="wpmenucart-product-name">'.$submenu_item_data['item_name'].'</span>';
- // Quantity x price
- $cart_submenu_item_content .= '<span class="wpmenucart-product-quantity-price">';
- $cart_submenu_item_content .= $submenu_item_data['item_price'];
- $cart_submenu_item_content .= '</span>';
- $cart_submenu_item_content .= '</span>';
- // Permalink wrap
- if ( $submenu_item_data['item_permalink'] != '' )
- $cart_submenu_item_content = sprintf('<a href="%s" class="clearfix">%s</a>', $submenu_item_data['item_permalink'], $cart_submenu_item_content );
- $cart_submenu_item_li = '<li class="menu-item wpmenucart-submenu-item clearfix">'.$cart_submenu_item_content.'</li>';
- return $wpmenucart_submenu_items;
- }
- }
- /**
- * Modify the content of the wpmenucart-content <a> tag
- */
- add_filter('wpmenucart_menu_item_a_content', 'add_wpmenucart_menu_item_a_content', 1, 1);
- function add_wpmenucart_menu_item_a_content ($content) {
- global $wpMenuCart;
- $item_data = $wpMenuCart->shop->menu_item();
- $cart_contents = sprintf(_n('%d item', '%d items', $item_data['cart_contents_count'], 'wpmenucart'), $item_data['cart_contents_count']);
- $content = '';
- $content .= '<i class="wpmenucart-icon-shopping-cart-'.$wpMenuCart->options['cart_icon'].'"></i>';
- $content .= '<span class="cartcontents another class">'.$cart_contents.'</span><span class="amount">'.$item_data['cart_total'].'</span>';
- return $content;
- }
- add_filter('wpmenucart_submenu_name_truncate', 'add_wpmenucart_submenu_name_truncate', 1, 1);
- function add_wpmenucart_submenu_name_truncate ($truncate) {
- $truncate = 50;
- return $truncate;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement