• 12-03-2013, 11:55:50
    #1
    Beyler;

    Ufak bir sorunum var çıkamadım işin içinden. Sitemde taxonomy'ler oluşturdum.

    Mesela;

    Yayınlanma Tarihi adında bir taxonomy oluşturdum ve her oyun için belirli tarih girdim. Örn: Şubat 2013, Ocak 2013, Kasım 2012 vb.

    Şimdi mesela bir sayfada Ocak 2013, Şubat 2013 ve Mart 2013 taxonomylerine sahip konuların listelenmesini istiyorum...

    Wordpress Codex'de

    $args = array(
    	'tax_query' => array(
    		array(
    			'taxonomy' => 'person',
    			'field' => 'slug',
    			'terms' => 'bob'
    		)
    	)
    );
    $query = new WP_Query( $args );
    Bu kodlar işime yarayacak gibi gözüküyor.

    Fakat oluşturduğum sayfada bu kodları kullandığımda bu taxonomy'lere ait konuları listelemiyor...

    Sanırım bu fonksiyonu functions'a ekliycem sonra sayfada çağırıcam...

    Bilgisi olan var mı ?
  • 12-03-2013, 16:41:39
    #2
    nasıl çağırdın kodunu bilmiyorum. örnek vereyim; taxonomy adın tarih olsun,
    kasım 2012
    $args = array(
        'tax_query' => array(
            array(
                'taxonomy' => 'tarih',
                'field' => 'slug',
                'terms' => 'kasim-2012'
            )
        )
    );
    $query = new WP_Query( $args );
  • 12-03-2013, 17:03:45
    #3
    Ben bu kodla ilgili yazının altına benzer taxonomiye sahip yazıları listedim.
    Bununla çalışarak bir yere varabilirsin.
    <?php
    		//for in the loop, display all "content", regardless of post_type,
    		//that have the same custom taxonomy (e.g. genre) terms as the current post
    		$found_none = '<h4>Benzer İlan bulunamadı!</h4>';
    		$taxonomy = 'mahalle';//  e.g. post_tag, category, custom taxonomy
    		$param_type = 'mahalle'; //  e.g. tag__in, category__in, but genre__in will NOT work
    		$tax_args=array('orderby' => 'date');
    		$tags = wp_get_post_terms( $post->ID , $taxonomy, $tax_args);
    			if ($tags) {
    				foreach ($tags as $tag) {
    
        			$args=array(
        			$param_type => $tag->slug,
        			'post__not_in' => array($post->ID),
        			'post_type' => 'ilanlar',
        			'showposts'=> 4,
        			'caller_get_posts'=> 1
        			);
    
        		$my_query = null;
        		$my_query = new WP_Query($args);
        		if( $my_query->have_posts() ) {
        		while ($my_query->have_posts()) : $my_query->the_post(); ?>
    	    		<div class="four columns listing">
    		    		<div class="post-container short">
    		    			<?php echo get_the_term_list( $post->ID, 'tip', '<span> ', ', ', '</span>' ); ?> 
    						<?php echo has_post_thumbnail() ? my_get_image() :  my_get_image_blank();?> 
    						<h5><a href="<?php the_permalink();?>"><?php the_title();?> </a></h5>
    						<a class="small button" href="<?php the_permalink();?>">&rarr;</a></p>			 
    					</div>
    				</div>
        		<?php $found_none = '';
        		endwhile;
        		}
        	}
        }
        if ($found_none) {
    	echo $found_none;
    	}
        wp_reset_query(); // to use the original query again
        ?>
  • 12-03-2013, 20:29:20
    #4
    Her ikisinde deniycem teşekkürler...