• 25-07-2017, 23:27:43
    #1
    Ziyaretçilere kategori kapatıp Üyelere kategori açmak istiyorum böyle bir şansım varmı veya uygulama vs?
  • 26-07-2017, 00:53:03
    #2
    Kimlik doğrulama veya yönetimden onay bekliyor.
    daha detaylı anlatabilir misiniz?
  • 26-07-2017, 01:25:47
    #3
    sanırım demek istediğin üye olmayanlar belirli kategorileri görmesini istemiyorsun.

    Bu sayfada istediğin şekilde kod paylaşılmış.

    add_filter('template_include', 'restict_by_category');
    
    function check_user() {
      $user = wp_get_current_user();
      if ( ! $user->ID || in_array('subscriber', $user->roles) ) {
        // user is not logged or is a subscriber
        return false;
      }
      return true;
    }
    
    function restict_by_category( $template ) {
      if ( ! is_main_query() ) return $template; // only affect main query.
      $allow = true;
      $private_categories = array('reserved', 'personal'); // categories subscribers cannot see
      if ( is_single() ) {
        $cats = wp_get_object_terms( get_queried_object()->ID, 'category', array('fields' => 'slugs') ); // get the categories associated to the required post
        if ( array_intersect( $private_categories, $cats ) ) {
          // post has a reserved category, let's check user
          $allow = check_user();
        }
      } elseif ( is_tax('category', $private_categories) ) {
        // the archive for one of private categories is required, let's check user
        $allow = check_user();
      }
      // if allowed include the required template, otherwise include the 'not-allowed' one
      return $allow ? $template : get_template_directory() . '/not-allowed.php';
    }


    veya


    https://wordpress.org/plugins/restrict-categories/ bu eklenti ile yapabilirsin.
  • 26-07-2017, 02:18:45
    #4
    sakarya adlı üyeden alıntı: mesajı görüntüle
    daha detaylı anlatabilir misiniz?
    Salihweb adlı üyeden alıntı: mesajı görüntüle
    sanırım demek istediğin üye olmayanlar belirli kategorileri görmesini istemiyorsun.

    Bu sayfada istediğin şekilde kod paylaşılmış.

    add_filter('template_include', 'restict_by_category');
    
    function check_user() {
      $user = wp_get_current_user();
      if ( ! $user->ID || in_array('subscriber', $user->roles) ) {
        // user is not logged or is a subscriber
        return false;
      }
      return true;
    }
    
    function restict_by_category( $template ) {
      if ( ! is_main_query() ) return $template; // only affect main query.
      $allow = true;
      $private_categories = array('reserved', 'personal'); // categories subscribers cannot see
      if ( is_single() ) {
        $cats = wp_get_object_terms( get_queried_object()->ID, 'category', array('fields' => 'slugs') ); // get the categories associated to the required post
        if ( array_intersect( $private_categories, $cats ) ) {
          // post has a reserved category, let's check user
          $allow = check_user();
        }
      } elseif ( is_tax('category', $private_categories) ) {
        // the archive for one of private categories is required, let's check user
        $allow = check_user();
      }
      // if allowed include the required template, otherwise include the 'not-allowed' one
      return $allow ? $template : get_template_directory() . '/not-allowed.php';
    }


    veya


    https://wordpress.org/plugins/restrict-categories/ bu eklenti ile yapabilirsin.

    Hocam belirlediğim bir kategori telif hakkından dolayı sadece üye olanlar görebilmeli, ama tema özel yazılım bir tema salih hocam bana yardımcı olabilirmisiniz özel dizi alanı kategori olarak geçmiyor sanırım nasıl yapabilirim ?
  • 26-07-2017, 03:32:01
    #5
    skype:yakup_sener ekleyin yardımcı olayım.
  • 27-07-2017, 04:35:53
    #6
    Skype: zafermertdursun1 ekleyin yardımcı olayım hocam


    Tapatalk kullanarak iPhone aracılığıyla gönderildi