芝麻web文件管理V1.00
编辑当前文件:/home/prismawe/backup/herve-tessa-maconnerie.fr/wp-content/themes/Crevision/functions.php
section add_theme_support( 'automatic-feed-links' ); // Clean up the function removeHeadLinks() { remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wlwmanifest_link'); } add_action('init', 'removeHeadLinks'); remove_action('wp_head', 'wp_generator'); // Custom Widgets include (get_template_directory() . '/inc/custom_widgets/latest-tweets.php'); // Latest Tweets include (get_template_directory() . '/inc/custom_widgets/flickr-stream.php'); // Flickr Stream include (get_template_directory() . '/inc/custom_widgets/facebook-like-box.php'); // Facebook Like Box include (get_template_directory() . '/inc/custom_widgets/tabs.php'); // Blog Tabs include (get_template_directory() . '/inc/custom_widgets/followers-count.php'); // Followers Count include (get_template_directory() . '/inc/custom_widgets/videos.php'); // Featured Videos include (get_template_directory() . '/inc/custom_widgets/subscribe-form.php'); // Subscribe Form include (get_template_directory() . '/inc/custom_widgets/latest-blog.php'); // Latest from Blog include (get_template_directory() . '/inc/custom_widgets/custom-content.php'); // Custom Content include (get_template_directory() . '/inc/custom_widgets/ads-125.php'); // Ads 125x125 include (get_template_directory() . '/inc/custom_widgets/ads-250.php'); // Ads 250x250 // Register Widgets include (get_template_directory() . '/inc/widgets.php'); // Shortcodes include (get_template_directory() . '/inc/shortcodes.php'); // Register Menu if ( function_exists( 'register_nav_menu' ) ) { register_nav_menus( array( 'headermenu' => 'Header Menu', ) ); } // Content & title Functions for cutting text content include (get_template_directory() . '/inc/content-limit.php'); // Pagination Function include (get_template_directory() . '/inc/pagination.php'); // Comments Functions include (get_template_directory() . '/inc/comments.php'); // Followers Functions include (get_template_directory() . '/inc/followers.php'); // Contact Process include (get_template_directory() . '/inc/contact-process.php'); // Posts Views function getPostViews($postID){ $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '1'); return "1"; } return $count.''; } function setPostViews($postID) { $count_key = 'post_views_count'; $count = get_post_meta($postID, $count_key, true); if($count==''){ $count = 0; delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, '1'); }else{ $count++; update_post_meta($postID, $count_key, $count); } } // Languages translatable for any language. load_theme_textdomain( 'jozoorthemes', get_template_directory().'/lang' ); $locale = get_locale(); $locale_file = get_template_directory()."/languages/$locale.php"; if ( is_readable($locale_file) ) require_once($locale_file); // Jozoor Panel Framework include (get_template_directory() . '/admin/jozoor_panel/index.php'); // Theme Options include (get_template_directory() . '/inc/theme-options.php'); // theme options if($resize_images == 0){ // this code for not resize attachment uploaded images in media liberary add_filter('intermediate_image_sizes_advanced', 'no_image_resizing'); function no_image_resizing($size) { $ret = array(); return $ret; } } // Enabling Support for Post Thumbnails add_theme_support( 'post-thumbnails' ); // add image size add_image_size( 'related-posts-thumbnail', 67, 52, false ); // GET FEATURED IMAGE function ST4_get_featured_image($post_ID) { $post_thumbnail_id = get_post_thumbnail_id($post_ID); if ($post_thumbnail_id) { $post_thumbnail_img = wp_get_attachment_image_src($post_thumbnail_id, 'featured_preview'); return $post_thumbnail_img[0]; } } // ADD NEW COLUMN function ST4_columns_head($defaults) { $defaults['featured_image'] = 'Featured Image'; return $defaults; } // SHOW THE FEATURED IMAGE function ST4_columns_content($column_name, $post_ID) { if ($column_name == 'featured_image') { $post_featured_image = ST4_get_featured_image($post_ID); if ($post_featured_image) { // HAS A FEATURED IMAGE echo '
'; } else { // NO FEATURED IMAGE, SHOW THE DEFAULT ONE echo '
'; } } } // ONLY WORDPRESS DEFAULT POSTS add_filter('manage_post_posts_columns', 'ST4_columns_head', 10); add_action('manage_post_posts_custom_column', 'ST4_columns_content', 10, 2); // Custom Post Type include (get_template_directory() . '/admin/custom_post_type/portfolio.php'); // Portfolio section include (get_template_directory() . '/admin/custom_post_type/post.php'); // Posts section include (get_template_directory() . '/admin/custom_post_type/team.php'); // Team section include (get_template_directory() . '/admin/custom_post_type/services.php'); // Services section include (get_template_directory() . '/admin/custom_post_type/clients.php'); // Clients section include (get_template_directory() . '/admin/custom_post_type/testimonials.php'); // Testimonials section include (get_template_directory() . '/admin/custom_post_type/page.php'); // Pages section include (get_template_directory() . '/admin/custom_post_type/ads.php'); // Ads section // content width for wordpress if ( ! isset( $content_width ) ) $content_width = 900; add_theme_support( 'woocommerce' ); /* start woocommerce custom configuration */ // Remove the breadcrumbs add_action( 'init', 'jozoor_remove_wc_breadcrumbs' ); function jozoor_remove_wc_breadcrumbs() { remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 ); } // Change number or products per row to 3 if (!function_exists('jozoor_loop_columns')) { function jozoor_loop_columns() { return 3; // 3 products per row } } // Display 12 products per page add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 12;' ), 20 ); // Remove the Product Count // remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 ); // Define image sizes global $pagenow; if ( is_admin() && isset( $_GET['activated'] ) && $pagenow == 'themes.php' ) add_action( 'init', 'jozoor_woocommerce_image_dimensions', 1 ); function jozoor_woocommerce_image_dimensions() { $catalog = array( 'width' => '451', // px 'height' => '451', // px 'crop' => 1 // true ); $single = array( 'width' => '600', // px 'height' => '600', // px 'crop' => 1 // true ); $thumbnail = array( 'width' => '120', // px 'height' => '120', // px 'crop' => 0 // false ); // Image sizes update_option( 'shop_catalog_image_size', $catalog ); // Product category thumbs update_option( 'shop_single_image_size', $single ); // Single product image update_option( 'shop_thumbnail_image_size', $thumbnail ); // Image gallery thumbs } // Ensure cart contents update when products are added to the cart via AJAX add_filter('add_to_cart_fragments', 'jozoor_woocommerce_header_add_to_cart_fragment'); function jozoor_woocommerce_header_add_to_cart_fragment( $fragments ) { global $woocommerce; ob_start(); ?>
cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?> - cart->get_cart_total(); ?>
get_related(4); $args = array( 'post_type' => 'product', 'no_found_rows' => 1, 'posts_per_page' => 4, 'ignore_sticky_posts' => 1, 'orderby' => 'rand', 'post__in' => $related, 'post__not_in' => array($product->id) ); return $args; } add_filter( 'woocommerce_related_products_args', 'jozoor_woo_related_products_limit' ); ?>