• 07-11-2018, 15:31:16
    #1
    Merhaba arkadaşlar,

    Storefront temasında sitem için yararlı gördüğüm bazı değişiklikler yaptım. Belki işine yarayan olur diye buraya da bırakıyourm.

    functions.php'de yaptığım değişiklikler:
    <?php
    /**
     * Storefront engine room
     *
     * @package storefront
     */
    
    /**
     * Assign the Storefront version to a var
     */
    $theme              = wp_get_theme( 'storefront' );
    $storefront_version = $theme['Version'];
    
    /**
     * Sepete ekle butonunu kaldırma */
    
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
    
    
    /**
     * Set the content width based on the theme's design and stylesheet.
     */
    if ( ! isset( $content_width ) ) {
    $content_width = 980; /* pixels */
    }
    
    $storefront = (object) array(
    'version' => $storefront_version,
    
    /**
     * Initialize all the things.
     */
    'main'       => require 'inc/class-storefront.php',
    'customizer' => require 'inc/customizer/class-storefront-customizer.php',
    );
    
    require 'inc/storefront-functions.php';
    require 'inc/storefront-template-hooks.php';
    require 'inc/storefront-template-functions.php';
    
    if ( class_exists( 'Jetpack' ) ) {
    $storefront->jetpack = require 'inc/jetpack/class-storefront-jetpack.php';
    }
    
    if ( storefront_is_woocommerce_activated() ) {
    $storefront->woocommerce = require 'inc/woocommerce/class-storefront-woocommerce.php';
    
    require 'inc/woocommerce/storefront-woocommerce-template-hooks.php';
    require 'inc/woocommerce/storefront-woocommerce-template-functions.php';
    }
    
    if ( is_admin() ) {
    $storefront->admin = require 'inc/admin/class-storefront-admin.php';
    
    require 'inc/admin/class-storefront-plugin-install.php';
    }
    
    /**
     * NUX
     * Only load if wp version is 4.7.3 or above because of this issue;
     * https://core.trac.wordpress.org/ticket/39610?cversion=1&cnum_hist=2
     */
    if ( version_compare( get_bloginfo( 'version' ), '4.7.3', '>=' ) && ( is_admin() || is_customize_preview() ) ) {
    require 'inc/nux/class-storefront-nux-admin.php';
    require 'inc/nux/class-storefront-nux-guided-tour.php';
    
    if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '3.0.0', '>=' ) ) {
    require 'inc/nux/class-storefront-nux-starter-content.php';
    }
    }
    /**
    * Hide shipping rates when free shipping is available.
    * Updated to support WooCommerce 2.6 Shipping Zones.
    *
    * @param array $rates Array of rates found for the package.
    * @return array
    */
    function my_hide_shipping_when_free_is_available( $rates ) {
    $free = array();
    foreach ( $rates as $rate_id => $rate ) {
    if ( ‘free_shipping’ === $rate->method_id ) {
    $free[ $rate_id ] = $rate;
    break;
    }
    }
    return ! empty( $free ) ? $free : $rates;
    }
    add_filter( ‘woocommerce_package_rates’, ‘my_hide_shipping_when_free_is_available’, 100 );
    
    /** TC Kimlik No Ekle **/
    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
    function custom_override_checkout_fields( $fields ) {
    $fields['billing']['shipping_tc'] = array(
    'label' => __('TC Kimlik No', 'woocommerce'),
    'placeholder' => _x('Fatura İçin Gerekli', 'placeholder', 'woocommerce'),
    'required' => true,
    'class' => array('form-row-wide'),
    'clear' => true
    );
    return $fields;
    }
    
    /** TC Doğrula Fonksiyonu **/
    function isTcKimlik($tc){
    if(strlen($tc) < 11){ return false; }
    if($tc[0] == '0'){ return false; }
    $plus = ($tc[0] + $tc[2] + $tc[4] + $tc[6] + $tc[8]) * 7;
    $minus = $plus - ($tc[1] + $tc[3] + $tc[5] + $tc[7]);
    $mod = $minus % 10;
    if($mod != $tc[9]){ return false; }
    $all = '';
    for($i = 0 ; $i < 10 ; $i++){ $all += $tc[$i]; }
    if($all % 10 != $tc[10]){ return false; }
    return true;
    }
    
    /**  TC Kimlik Noyu Doğrula **/
    add_action('woocommerce_checkout_process', 'my_custom_checkout_field_process');
    function my_custom_checkout_field_process() {
    $tcno = $_POST['shipping_tc'];
    if(!isTcKimlik($tcno))
    wc_add_notice( __( 'Lütfen Doğru Bir TC Kimlik No Girin.' ), 'error' );
    }
    
    /** Adminin Sipariş Detayında Fatura Bilgilerinde TC No'yu Görebilmesi İçin**/
    add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_checkout_field_display_admin_order_meta', 10, 1 );
    function my_custom_checkout_field_display_admin_order_meta($order){
    echo '<p><strong>'.__('TC Kimlik No').':</strong> ' . get_post_meta( $order->get_id(), '_shipping_tc', true ) . '</p>';
    }
    
    /**
     * Note: Do not add any custom code here. Please use a custom plugin so that your customizations aren't lost during updates.
     * https://github.com/woocommerce/theme-customisations
     */
    
    /**
     * zayıf şifre
     */
    
    function wc_ninja_remove_password_strength() {
    if ( wp_script_is( 'wc-password-strength-meter', 'enqueued' ) ) {
    wp_dequeue_script( 'wc-password-strength-meter' );
    }
    }
    add_action( 'wp_print_scripts', 'wc_ninja_remove_password_strength', 100 );
    
    /**
     * stok sayısı gizleme
     */
    function my_wc_hide_in_stock_message( $html, $text, $product ) {
    $availability = $product->get_availability();
    if ( isset( $availability['class'] ) && 'in-stock' === $availability['class'] ) {
    return '';
    }
    return $html;
    }
    add_filter( 'woocommerce_stock_html', 'my_wc_hide_in_stock_message', 10, 3 );
    Anasayfa sepetteki items yazısını ürün olarak değiştirme:
    ../themes/storefront/inc/woocommerce/storefront-woocommerce-template-functions.php yolunu takip edin. 75. satırda bulunan items ve item yazılarını ürün olarak değiştirin.

    New yazısını Ürün olarak değiştirme:
    storefront2incstorefront-template-functions yolunu takip edin. 617. satırda

    Ödeme sayfasında sokak adresi yazısını adres olarak değiştirme:
    /home/muhendi4/public_html/wp-content/plugins/woocommerce/includes/class-wc-countries.php yolunu takip edin. 654. satırdaki street address yazısını adres olarak değiştirin.

    Değişiklik yaptıkça eklerim buraya.
  • 15-03-2021, 16:15:20
    #2
    Merhabalar bu temadaki footer yazısını nasıl kaldırabileceğimi bulamadım. Ya footer tamamen devre dışı kalıyor ya da yazıyı editleyebileceğim yer bulamıyorum. Halbuki benim footera bazı sayfa linkleri koymam gerekiyor.
  • 15-03-2021, 21:49:20
    #3
    jngoldman adlı üyeden alıntı: mesajı görüntüle
    Merhabalar bu temadaki footer yazısını nasıl kaldırabileceğimi bulamadım. Ya footer tamamen devre dışı kalıyor ya da yazıyı editleyebileceğim yer bulamıyorum. Halbuki benim footera bazı sayfa linkleri koymam gerekiyor.
    Merhabalar hocam,

    https://wordpress.org/plugins/storefront-footer-text/ eklentisini sitenize kurduktan sonra Özelleştir'den Alt Kısım menüsünden düzenleyebilirsiniz.