• 08-08-2012, 16:00:47
    #1
    Kimlik doğrulama veya yönetimden onay bekliyor.
    Emlak sitemde bir evin altına tıkladığında o ev hakkında bilgiler çıktıktan sonra en altta "ALTERNATİFLER" die bir bölüm ve alternatif evler çıkmakta. Ancak ne hikmetse hep aynı 3 ev çıkıyor diğer tüm evlere tıkladığımızda.. Nasıl bunu katagoriye göre değiştirebiliriz. Mesela ilk tıklanan ev 1+1 ise alternatif olarak yine 1+1 ler çıksın...

    Umarım bir çözümü vardır...

    <h3>Alternatifler</h3>
    <br>
    <?php
    					if(isset($_GET['author_name'])) :
    					$curauth = get_userdatabylogin($author_name);
    					else :
    					$curauth = get_userdata(intval($author));
    					endif;
    				?>
    
      			<?php the_post(); ?>
    
    			
    				<?php rewind_posts(); ?>
    
    
    
    		<!-- The Loop -->
    			<?php
    			$authid =get_the_author_ID();
    	   	    $show = get_settings($shortname."_homePostCategory");			
    			$moreprop = new WP_query();
    			$moreprop->Query('showposts=3&cat=-' . $show . '&author='.$authid .'');
    
    
    ?>
    
    <?php while ($moreprop->have_posts()) : $moreprop->the_post(); ?>		
    		
    
    <div class="latest_listings">
    <div class="price">
    	   
    	  </div>
    	<div><a href="<?php the_permalink() ?>" class="left_posts_link" rel="bookmark"><?php
    for($i = 1; $i <= 1; $i++){
    $image = get_post_meta($post->ID, "red_image".$i, true);
    $blogurl = get_bloginfo('template_url');
    if($image){
    $output = '<img  src="'.$blogurl.'/thumbnail.php?src='.$image.'&amp;h=80&amp;w=150&amp;zc=0" alt="Featured Home" />';
    echo $output;
    }
    }
    ?>
    </a>
    </div>	
    			
    	  <div class="grid-left">
    	  	  <a class="view" title="Permanent Link to <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><img src="<?php bloginfo('template_url') ?>/images/view.png" /></a>
    	  
    	  	<p style="margin:0px 5px 5px 0px;"><?php echo $bed ;?> <?php echo ' ' ;?>
    								<?php echo $bath ;?><?php echo '  ' ;?><br>
    </div> <!-- end entry -->
    </div>
    <?endwhile; ?>
    <!-- End Loop -->
  • 08-08-2012, 18:39:39
    #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'=>5,
    		'caller_get_posts'=>1
    	);
    
            $my_query = new wp_query($args);
    	if( $my_query->have_posts() ) {
    		echo '<h3>Alternatifler</h3><ul>';
    		while ($my_query->have_posts()) {
    			$my_query->the_post();
    		?>
    			<li><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
    		<?php
    		}
    		echo '</ul>';
    	}
    wp_reset_query();
    }
    ?>
    Aynı kategorideki alternatifleri bu kod ile gösterebilirsiniz.
  • 09-08-2012, 00:32:45
    #3
    Misafir 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'=>5,
    		'caller_get_posts'=>1
    	);
            $my_query = new wp_query($args);
    	if( $my_query->have_posts() ) {
    		echo '<h3>Alternatifler</h3><ul>';
    		while ($my_query->have_posts()) {
    			$my_query->the_post();
    		?>
    			<li><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
    		<?php
    		}
    		echo '</ul>';
    	}
    wp_reset_query();
    }
    ?>
    Aynı kategorideki alternatifleri bu kod ile gösterebilirsiniz.
    hocam bu kodu benim verdiğim kod sayfasında nereye yapıştırmam lazım? veya siz kodun üstüne eklemişsiniz bende o şekilde mi eklemeliyim?
  • 09-08-2012, 10:01:52
    #4
    whoyouare adlı üyeden alıntı: mesajı görüntüle
    hocam bu kodu benim verdiğim kod sayfasında nereye yapıştırmam lazım? veya siz kodun üstüne eklemişsiniz bende o şekilde mi eklemeliyim?

    <?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'=>5,
            'caller_get_posts'=>1
        );
    
            $my_query = new wp_query($args);
        if( $my_query->have_posts() ) {
            echo '<h3>Alternatifler</h3>';
            while ($my_query->have_posts()) {
                $my_query->the_post();
            ?>  
            
    
    <div class="latest_listings">
    <div class="price">
           
          </div>
        <div><a href="<?php the_permalink() ?>" class="left_posts_link" rel="bookmark"><?php
    for($i = 1; $i <= 1; $i++){
    $image = get_post_meta($post->ID, "red_image".$i, true);
    $blogurl = get_bloginfo('template_url');
    if($image){
    $output = '<img  src="'.$blogurl.'/thumbnail.php?src='.$image.'&amp;h=80&amp;w=150&amp;zc=0" alt="Featured Home" />';
    echo $output;
    }
    }
    ?>
    </a>
    </div>    
                
          <div class="grid-left">
                <a class="view" title="Permanent Link to <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><img src="<?php bloginfo('template_url') ?>/images/view.png" /></a>
          
              <p style="margin:0px 5px 5px 0px;"><?php echo $bed ;?> <?php echo ' ' ;?>
                                    <?php echo $bath ;?><?php echo '  ' ;?><br>
    </div> 
    </div>
    
    <?php
            }
            
        }
    wp_reset_query();
    }
    ?>
        <?php endwhile; ?>
    tam göremediğim için ancak bu kadar yardımcı olabiliyorum hocam. bu şekilde dener misin?

    Dosyanın yedeğini mutlaka alın.