• 01-01-2017, 13:19:32
    #1
    Merhabalar, kısaca açıklamak gerekirse;

    http://www.animeizlex.com/dizi/classicaloid/

    örneğin şurada bir dizinin genel açıklaması vs mevcut. Ben buraya "bu kategoriye ait" konuları nasıl çekebilirim ?

    Mesela benim şuanda kullandığım kod bu;

    <ul>
    <?php $postslist = get_posts('numberposts=10&category=3');
    foreach ($postslist as $post) : setup_postdata($post); ?>
    <li><a href="<?php the_permalink(); ?>" rel="bookmark" title="< ?php the_title(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>
    </ul>
    Burada kategori numarası 3 olan konuları çekiyor sadece. Ama benim istediğim o anda hangi kategorideysek onun konularını çeksin istiyorum ..
  • 01-01-2017, 20:02:26
    #2
    <?php
    	$categories = get_the_category($post->ID); 
    	if ($categories) { $category_ids = array(); 
    	foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
    	$args=array('category__in' => $category_ids,'post__not_in' => array($post->ID), 'showposts'=>3, 'caller_get_posts'=>1 ); 
    	$my_query = new wp_query($args); if( $my_query->have_posts() ) { echo ''; while ($my_query->have_posts()) { $my_query->the_post(); 
    ?>
    <li><a href="<?php the_permalink(); ?>" rel="bookmark" title="< ?php the_title(); ?>"><?php the_title(); ?></a></li>
    
    
    <?php } } wp_reset_query(); } ?>

    Bu şekilde yaparsaız kategorideki konuları getirir hocam
  • 01-01-2017, 23:28:13
    #3
    _SecreT_ adlı üyeden alıntı: mesajı görüntüle
    <?php
    	$categories = get_the_category($post->ID); 
    	if ($categories) { $category_ids = array(); 
    	foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
    	$args=array('category__in' => $category_ids,'post__not_in' => array($post->ID), 'showposts'=>3, 'caller_get_posts'=>1 ); 
    	$my_query = new wp_query($args); if( $my_query->have_posts() ) { echo ''; while ($my_query->have_posts()) { $my_query->the_post(); 
    ?>
    <li><a href="<?php the_permalink(); ?>" rel="bookmark" title="< ?php the_title(); ?>"><?php the_title(); ?></a></li>
    
    
    <?php } } wp_reset_query(); } ?>

    Bu şekilde yaparsaız kategorideki konuları getirir hocam
    Hocam çok teşekkür ederim oldu (: