1. Halo Guest, pastikan Anda selalu menaati peraturan forum sebelum mengirimkan post atau thread baru.

[ASK]Cara menampilkan tags berdasarkan ID per kategory

Discussion in 'Wordpress' started by wpdevep, Jul 11, 2015.

  1. wpdevep

    wpdevep Ads.id Pro

    Joined:
    Apr 6, 2012
    Messages:
    453
    Likes Received:
    92
    Location:
    Tebet, Jakarta Selatan
    Halo mastah, langsung aja. Saya ada script untuk menampilkan list tags perkategori, tapi masalahnya tiap ada tag sama di kategori tersebut tetap ditampilkan. Berikut scriptnya:
    Code:
    <ul class="inline-list">
                    <?php
                        query_posts('category_name=buah-buahan');
                        if (have_posts()) : while (have_posts()) : the_post();
    
                            if( get_the_tag_list() ){
                                echo $posttags = get_the_tag_list('<li>','</li><li>','</li>');
                            }
    
                        endwhile; endif; 
    
                        wp_reset_query(); 
                    ?>
                  </ul>
    
    Gimana ya supaya supaya menampilkan list tags by ID per kategory?

    Tengkyu sebelumnya :gembira:
     
  2. nasdin

    nasdin Super Hero

    Joined:
    May 28, 2013
    Messages:
    806
    Likes Received:
    182
    coba ini om, http://www.wprecipes.com/wordpress-trick-function-to-get-tags-related-to-category

    untuk mendapatkan current category ID bisa pake get_query_var('cat');
     
  3. noidsit

    noidsit Newbie

    Joined:
    Jul 1, 2015
    Messages:
    13
    Likes Received:
    0
    keluarin itu tag list jadi array

    trus pake fungsi array_unique di php
     

Share This Page