Exclude Ketegori pada index Home

Discussion in 'HTMLy' started by Yen Leidong, May 9, 2017.

  1. Yen Leidong

    Yen Leidong New Member

    Joined:
    May 8, 2017
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    @Dan atau teman-teman yg lain mungkin tau cara gimana supaya bisa di exclude salah satu Category pada loop posts halaman depan?

    btw, saya sudah test bongkar" sana-sini, tapi gak berhasil, mungkin ada yg lebih ngerti?

    Thanks.
     
  2. KangAndre

    KangAndre Member

    Joined:
    Jan 25, 2014
    Messages:
    9,917
    Likes Received:
    2,604
    Trophy Points:
    313
    Kalau di wordpress bisa menambahkan ini

    Code:
    add_filter('pre_get_posts', 'excludeCat'); 
    function excludeCat($query) {
     if ( $query->is_home ) { 
    $query->set('cat', '-3,-5,-23'); } 
    return $query;
     }
    
     
  3. Yen Leidong

    Yen Leidong New Member

    Joined:
    May 8, 2017
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    udah dicoba, tapi malah error.
    setahu saya htmly tidak ada fungsi add_filter nya.
     
  4. KangAndre

    KangAndre Member

    Joined:
    Jan 25, 2014
    Messages:
    9,917
    Likes Received:
    2,604
    Trophy Points:
    313
    sebenarnya di HTMLy ada folder plugin (di system). Seharusnya di folder ini bisa ditambah fungsi.
    Mengingat saya sudah nggak sempat lagi otak-atik PHP... mungkin @Dan yang bisa membantu banyak.
     
  5. Yen Leidong

    Yen Leidong New Member

    Joined:
    May 8, 2017
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    ya juga, baru sadar, gua coba pelajari dulu.

    btw, thanks banget buat info nya Bro.
     

Share This Page