• 30-05-2013, 18:14:13
    #1
    s.a merhabalar, yazılara etiket atıp benzer yazıları çıkarmaktan bıktık. elimde böyle bir kod var. Bu kod single.php içine ekleniyor ve katagorilerdeki benzer yazılar cıkıyor. yalnız bu kodu nereye eklemem gerek bulamadım fikri olan bir arkadaş var mı?

    <?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, // Gösterilecek benzer yazı sayısı
          'caller_get_posts'=>1
       );
             
            $my_query = new wp_query($args);
       if( $my_query->have_posts() ) {
          echo '<h3>Benzer yazılar</h3><ul>';
          while ($my_query->have_posts()) {
             $my_query->the_post();
          ?>
             <li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
          <?php
          }
          echo '</ul>';
       }
    wp_reset_query();
    }
    ?>
  • 30-05-2013, 18:24:33
    #2
    Kimlik doğrulama veya yönetimden onay bekliyor.
    valla zor soru da ... deneme yanılma ile kendinde bulabilirsin ...single.php yi önce bi yedek al ... konu sonuna ekle baktın calıstı devam calısmadı ise yedegi geri at sonra bi kaç satır alta falan filan ... kodlar az cok gozune ilişir... konu sona eklemen lazım ...
  • 30-05-2013, 18:25:29
    #3
    xJiNx adlı üyeden alıntı: mesajı görüntüle
    valla zor soru da ... deneme yanılma ile kendinde bulabilirsin ...single.php yi önce bi yedek al ... konu sonuna ekle baktın calıstı devam calısmadı ise yedegi geri at sonra bi kaç satır alta falan filan ... kodlar az cok gozune ilişir... konu sona eklemen lazım ...
    Aklım mı oynattım sabahtan beri bununla ugrasıyorum.
  • 30-05-2013, 18:26:16
    #4
    single.php yi görmeden bişey soylemek zor
  • 30-05-2013, 18:27:48
    #5
    xJiNx adlı üyeden alıntı: mesajı görüntüle
    single.php yi görmeden bişey soylemek zor
    Atalım hemen (:
  • 30-05-2013, 18:28:31
    #6
    mesela <p>Etiketler : <?php the_tags('',', ','') ?></p>

    </div>


    </div> sonrasına bu kodu eklersem çalısır bendeki single da ....

    --R10.NET; Flood Engellendi -->-> Yeni yazılan mesaj 18:28:31 -->-> Daha önceki mesaj 18:27:56 --

    işyerindeyim çıkmam lazım . aksam saatlerinde pc de olursan yardımcı olmaya calısırım.. kactım ben ...
  • 30-05-2013, 18:29:21
    #7
    Burada bir yere eklenmesi gerek ama nereye

    <?php if(get_option('pyre_author') == 'On'): ?> 
    				<div class="post-author">
    					<?php echo get_avatar(get_the_author_meta('email'), '70'); ?>
    					<h5><em><?php _e('About the author:', 'Avenue'); ?></em> <?php the_author_link(); ?> <small><?php _e('Bütün mesajlar'); ?> <?php the_author_posts_link(); ?></small></h5>
    					<div class="author-descrip"><?php the_author_meta("description"); ?></div>
    					<?php if(get_the_author_meta('twitter') || get_the_author_meta('facebook')): ?>
    					<p>
    						<br />
    						<?php if(get_the_author_meta('twitter')): ?>
    						<a href='http://twitter.com/<?php echo get_the_author_meta('twitter'); ?>'>Twitter</a>
    						<?php endif; ?>
    						
    						<?php if(get_the_author_meta('twitter') || get_the_author_meta('facebook')): ?>
    						-
    						<?php endif; ?>
    						
    						<?php if(get_the_author_meta('facebook')): ?>
    						<a href='http://facebook.com/<?php echo get_the_author_meta('facebook'); ?>'>Facebook</a>
    						<?php endif; ?>
    					</p>
    					<?php endif; ?>
    				</div>
    				<?php endif; ?>
    				
    				<?php $tags = get_the_tags(); ?>
    				<?php if($tags): ?>
    				<?php $related = get_related_posts($post->ID, $tags); ?>
    				<?php if($related->have_posts() && $related->found_posts >= 3 && get_option('pyre_related') == 'On'): ?>
    				<div class='homepage-widget'>
    					<div class="block full">
    						
    						<h3>En Çok Okunanlar<span class="arrows">&raquo;</span></h3>
    							
    							<?php while($related->have_posts()): $related->the_post(); ?>
    								<?php if(has_post_thumbnail()): ?>
    								<?php
    								if(has_post_format('video') || has_post_format('audio') || has_post_format('gallery')) {
    									$icon = '<span class="' . get_post_format($post->ID) . '-icon"></span>';
    								} else {
    									$icon = '';
    								}
    								?>
    								<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'related-thumb'); ?>
    								<div class="related-item">
    								<?php echo $icon; ?><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><img src="<?php echo $image[0]; ?>" alt="<?php the_title(); ?>" width='134' height='90' /></a>
    								<h2><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?></a></h2>
    								</div>
    								<?php else: ?>
    								<div class="related-item">
    								<?php echo $icon; ?><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php bloginfo('template_directory'); ?>/images/thumbnail.png&w=134&h=90" alt="<?php the_title(); ?>" width='134' height='90' /></a>
    								<h2><a href='<?php the_permalink(); ?>' title='<?php the_title(); ?>'><?php the_title(); ?></a></h2>
    								</div>
    								<?php endif; ?>
    							<?php endwhile; ?>
    					
    					</div>
    				</div>
    				<?php endif; ?>
    				<?php endif; ?>
    				<?php wp_reset_query(); ?>
    				
    				<div id="comments">
    				
    					<?php comments_template(); ?>
    					
    				</div>
    				
    				<?php endwhile; endif; ?>
    			
    			</div>
    			<!-- END MAIN -->
    			
    <?php get_sidebar(); ?>
    			
    <?php get_footer(); ?>
  • 30-05-2013, 18:38:08
    #8
    <!-- END MAIN -->
    burayı dene )
  • 30-05-2013, 18:44:52
    #9
    muhatapx adlı üyeden alıntı: mesajı görüntüle
    <!-- END MAIN -->
    burayı dene )
    Sağ üst köşede çıktı

    --R10.NET; Flood Engellendi -->-> Yeni yazılan mesaj 18:44:52 -->-> Daha önceki mesaj 18:41:20 --

    Hallettim çok teşekkür ederim