• 30-11-2020, 13:53:56
    #1
    merhaba arkadaşlar, kendi kullandığım ve not almak için burada derleme yapmayı hedeflediğim bir konu. faydası dokunmak isteyenler kendi kullandıkları kodları iletebilirler detaylı şekilde konuya ekleme yapabilirim.

    Belli Bir Kategoriyi Listelemede, Ürün Sayfasında, Özel Taksonomilerden Kaldırma
    function get_subcategory_terms( $terms, $taxonomies, $args ) {    $new_terms     = array();    $hide_category     = array( 15,1472 );    if ( in_array( 'product_cat', $taxonomies ) && !is_admin() && is_shop() || is_product_category() || is_tax("product_brand") ) {        foreach ( $terms as $key => $term ) {        if ( ! in_array( $term->term_id, $hide_category ) ) {             $new_terms[] = $term;        }        }        $terms = $new_terms;    }  return $terms;}add_filter( 'get_terms', 'get_subcategory_terms', 10, 3 );
    belirli bir taksonomide gözükmemesini sağlamak için > is_tax("product_brand")
    kategori sayfalarında gözükmesin diye > is_product_category
    ürün sayfalarında gözükmesin diye > is_shop

    YoastSEO Kullananlar İçin Kaynaktan Yoast Yazısı Kaldırma
    add_action('wp_head',function() { ob_start(function($o) {return preg_replace('/\n?<.*?yoast seo plugin.*?>/mi','',$o);}); },~PHP_INT_MAX);
    Kuponlarınızı Link Haline Getirip Butonlarda Kullanabilir Hale Getirme
    function webroom_woocommerce_coupon_links(){    if (!function_exists('WC') || !WC()->session) {        return;    }    $query_var = apply_filters('woocommerce_coupon_links_query_var', 'coupon_code');    if (empty($_GET[$query_var])) {        return;    }    WC()->session->set_customer_session_cookie(true);    if (!WC()->cart->has_discount($_GET[$query_var])) {        WC()->cart->add_discount($_GET[$query_var]);    }}add_action('wp_loaded', 'webroom_woocommerce_coupon_links', 30);add_action('woocommerce_add_to_cart', 'webroom_woocommerce_coupon_links');
    siteniz.com/istediginizbirbolumyadaanasayfa/?coupon_code=KUPONKODUN bunu bir butona atayarak kullanıcıların direkt sepete entegre etmesini sağlayabilirsiniz.

    Çerez Politikası Sağ Altta Çıkartma (Cookie Notice Without Plugin)

    <style>#cookie-law-div{z-index:10000000;position:fixed;bottom:3%;right:2%;padding:1em;max-width:400px;border-radius:10px;background:#fff;border:1px solid rgba(0,0,0,.15);font-size:15px;box-shadow:rgba(23,43,99,.4) 0 7px 28px}@media (max-width:600px){#cookie-law-div{border-radius:0;max-width:100%;right:0;bottom:0}}#cookie-law-div a{font-size:15px;text-decoration:none;border-bottom:1px solid rgba(0,0,0,.5)}#cookie-law-div a:hover{opacity:.7}#cookie-law-div p{margin:0;color:#000;padding-right:50px}#cookie-law-div button{position:absolute;right:.5em;top:20px;align-self:center;line-height:1;color:#fff;background-color:#000;border:none;opacity:.6;font-size:12px;cursor:pointer;border-radius:50px}#cookie-law-div button:hover{opacity:1}</style>
    <script>cookieLaw={dId:"cookie-law-div",bId:"cookie-law-button",iId:"cookie-law-item",show:function(e){if(localStorage.getItem(cookieLaw.iId))return!1;var o=document.createElement("div"),i=document.createElement("p"),t=document.createElement("button");i.innerHTML=e.msg,t.id=cookieLaw.bId,t.innerHTML=e.ok,o.id=cookieLaw.dId,o.appendChild(t),o.appendChild(i),document.body.insertBefore(o,document.body.lastChild),t.addEventListener("click",cookieLaw.hide,!1)},hide:function(){document.getElementById(cookieLaw.dId).outerHTML="",localStorage.setItem(cookieLaw.iId,"1")}},cookieLaw.show({msg:"We use cookies to give you the best possible experience. By continuing to visit our website, you agree to the use of cookies as described in our <a href='#'>Cookie Policy</a>",ok:"x"});</script>
    Özelleştirden footer kısmına ekleyebilirsiniz, onun dışında isterseniz footer.php ekleyedebilirsiniz size kalmış. Body öncesinde eklemiş olun yeter işte.
  • 20-12-2020, 18:10:47
    #2
    Hd2 adlı üyeden alıntı: mesajı görüntüle
    merhaba arkadaşlar, kendi kullandığım ve not almak için burada derleme yapmayı hedeflediğim bir konu. faydası dokunmak isteyenler kendi kullandıkları kodları iletebilirler detaylı şekilde konuya ekleme yapabilirim.

    Belli Bir Kategoriyi Listelemede, Ürün Sayfasında, Özel Taksonomilerden Kaldırma
    function get_subcategory_terms( $terms, $taxonomies, $args ) {    $new_terms     = array();    $hide_category     = array( 15,1472 );    if ( in_array( 'product_cat', $taxonomies ) && !is_admin() && is_shop() || is_product_category() || is_tax("product_brand") ) {        foreach ( $terms as $key => $term ) {        if ( ! in_array( $term->term_id, $hide_category ) ) {             $new_terms[] = $term;        }        }        $terms = $new_terms;    }  return $terms;}add_filter( 'get_terms', 'get_subcategory_terms', 10, 3 );
    belirli bir taksonomide gözükmemesini sağlamak için > is_tax("product_brand")
    kategori sayfalarında gözükmesin diye > is_product_category
    ürün sayfalarında gözükmesin diye > is_shop

    YoastSEO Kullananlar İçin Kaynaktan Yoast Yazısı Kaldırma
    add_action('wp_head',function() { ob_start(function($o) {return preg_replace('/\n?<.*?yoast seo plugin.*?>/mi','',$o);}); },~PHP_INT_MAX);
    Kuponlarınızı Link Haline Getirip Butonlarda Kullanabilir Hale Getirme
    function webroom_woocommerce_coupon_links(){    if (!function_exists('WC') || !WC()->session) {        return;    }    $query_var = apply_filters('woocommerce_coupon_links_query_var', 'coupon_code');    if (empty($_GET[$query_var])) {        return;    }    WC()->session->set_customer_session_cookie(true);    if (!WC()->cart->has_discount($_GET[$query_var])) {        WC()->cart->add_discount($_GET[$query_var]);    }}add_action('wp_loaded', 'webroom_woocommerce_coupon_links', 30);add_action('woocommerce_add_to_cart', 'webroom_woocommerce_coupon_links');
    siteniz.com/istediginizbirbolumyadaanasayfa/?coupon_code=KUPONKODUN bunu bir butona atayarak kullanıcıların direkt sepete entegre etmesini sağlayabilirsiniz.

    Çerez Politikası Sağ Altta Çıkartma (Cookie Notice Without Plugin)

    <style>#cookie-law-div{z-index:10000000;position:fixed;bottom:3%;right:2%;padding:1em;max-width:400px;border-radius:10px;background:#fff;border:1px solid rgba(0,0,0,.15);font-size:15px;box-shadow:rgba(23,43,99,.4) 0 7px 28px}@media (max-width:600px){#cookie-law-div{border-radius:0;max-width:100%;right:0;bottom:0}}#cookie-law-div a{font-size:15px;text-decoration:none;border-bottom:1px solid rgba(0,0,0,.5)}#cookie-law-div a:hover{opacity:.7}#cookie-law-div p{margin:0;color:#000;padding-right:50px}#cookie-law-div button{position:absolute;right:.5em;top:20px;align-self:center;line-height:1;color:#fff;background-color:#000;border:none;opacity:.6;font-size:12px;cursor:pointer;border-radius:50px}#cookie-law-div button:hover{opacity:1}</style>
    <script>cookieLaw={dId:"cookie-law-div",bId:"cookie-law-button",iId:"cookie-law-item",show:function(e){if(localStorage.getItem(cookieLaw.iId))return!1;var o=document.createElement("div"),i=document.createElement("p"),t=document.createElement("button");i.innerHTML=e.msg,t.id=cookieLaw.bId,t.innerHTML=e.ok,o.id=cookieLaw.dId,o.appendChild(t),o.appendChild(i),document.body.insertBefore(o,document.body.lastChild),t.addEventListener("click",cookieLaw.hide,!1)},hide:function(){document.getElementById(cookieLaw.dId).outerHTML="",localStorage.setItem(cookieLaw.iId,"1")}},cookieLaw.show({msg:"We use cookies to give you the best possible experience. By continuing to visit our website, you agree to the use of cookies as described in our <a href='#'>Cookie Policy</a>",ok:"x"});</script>
    Özelleştirden footer kısmına ekleyebilirsiniz, onun dışında isterseniz footer.php ekleyedebilirsiniz size kalmış. Body öncesinde eklemiş olun yeter işte.
    Güzel paylasim teşekkürler peki "urun-kategori" ve "urün" permalink kalıcı bağlantı kaldırmak için birşey kullanmıyor musunuz ?
  • 27-12-2020, 13:54:56
    #3
    muratback adlı üyeden alıntı: mesajı görüntüle
    Güzel paylasim teşekkürler peki "urun-kategori" ve "urün" permalink kalıcı bağlantı kaldırmak için birşey kullanmıyor musunuz ?
    Kullandığım vardı yada sen Google'layıp bulup yazarsan yorum olarak fena olmaz burası canlı tutarsak herkesin işini görür.