• 27-07-2008, 22:48:32
    #1
    Arkadaslar bugun bir alanadima wordpress kurdum.Ama wpden hic anlamadigim icin bir sorunum var.Mesela Istanbul diye bir kategorim var.Misal bu kategori altinda 3 tane tarihi, turistik yerleri ve sehir plani diye yazi olsun.Simdi ben tarihi yazisi okunurken bu yazinin altina nasil diger 2 yazinin linkini siralayabilirim?Lütfen yani bir kategorideki yazi okunurken bu kategorinin diger yazilarinin linkleride altta siralansin
  • 27-07-2008, 22:58:24
    #2
    temanızın single.php dosyasına aşağıdaki kodları ekleyin

    	<div class="relatedposts">
    <h3>İlgili Yazılar</h3>
    <ul>
    <?php foreach ( $posts as $post ) : ?>
    <li><a href="<?php the_permalink() ?>" title="<?php echo trim(str_replace("\n"," ",preg_replace('#<[^>]*?>#si','',get_the_excerpt()))) ?>"><?php if ( get_the_title() ){ the_title(); }else{ echo "Untitled"; } ?></a> (<?php the_time('M d, Y') ?>)</li>
    <?php endforeach // $posts as $post ?>
    </ul>
    		</div>

    style.css dosyasınada aşağıdaki kodları ekleyin

    Alıntı
    .relatedposts a{
    text-decoration: underline;
    }
    .relatedposts h3{
    padding-left: 7px;
    text-decoration: underline;
    }
  • 27-07-2008, 23:03:10
    #3
    gevv adlı üyeden alıntı: mesajı görüntüle
    temanızın single.php dosyasına aşağıdaki kodları ekleyin
    	<div class="relatedposts">
    <h3>İlgili Yazılar</h3>
    <ul>
    <?php foreach ( $posts as $post ) : ?>
    <li><a href="<?php the_permalink() ?>" title="<?php echo trim(str_replace("\n"," ",preg_replace('#<[^>]*?>#si','',get_the_excerpt()))) ?>"><?php if ( get_the_title() ){ the_title(); }else{ echo "Untitled"; } ?></a> (<?php the_time('M d, Y') ?>)</li>
    <?php endforeach // $posts as $post ?>
    </ul>
    		</div>
    style.css dosyasınada aşağıdaki kodları ekleyin
    gevv cok tesekkurler.Yalniz sadece okunan konun linki gorunuyor aceba nerede hata yapmis olabilirim.
  • 27-07-2008, 23:07:46
    #4
    yalnışlık olmuş kusura bakma aşağıdaki kodu single.php dosyasına eklemen yeterli diğerlerini silin


    <?php
    $this_post = $post;
    $category = get_the_category(); $category = $category[0]; $category = $category->cat_ID;
    $posts = get_posts('numberposts=5&offset=0&orderby=post_date&order=DESC&category='.$category);
    $count = 0;
    foreach ( $posts as $post ) {
    if ( $post->ID == $this_post->ID || $count == 5) {
    unset($posts[$count]);
    }else{
    $count ++;
    }
    }
    ?>
    <?php if ( $posts ) : ?>
    <ul>
    <?php function getWords($text, $limit) {
    $array = explode(" ", $text, $limit +1);
    if(count($array) > $limit) {
    unset($array[$limit]);
    }
    return implode(" ", $array); }
    ?>
    <?php foreach ( $posts as $post ) : ?>
    <?php $mycontent = strip_tags($post->post_content);
    $excerpt = getWords($mycontent, 15);
    $a_title = $excerpt . "..."; ?>
    <li><a href="<?php the_permalink(); ?>" title="<?php echo $a_title ?>">
    <?php if ( get_the_title() ) { the_title(); } else { echo "Untitle"; } ?></a>
    <?php endforeach // $posts as $post ?>
    </ul>
    <?php endif // $posts ?>
    <?php
    $post = $this_post;
    unset($this_post);
    ?>

    numberposts=5 değerini arttırdığınızda görünen yazı sayısı artar
  • 27-07-2008, 23:10:25
    #5
    gdi
    Üyeliği durduruldu
    related post yerinde PageNavi eklentisini kullansan ???
  • 27-07-2008, 23:11:51
    #6
    Arkadaslar ikinizede cok tesekkur ederim gevv'in 2. verdigi kod calisti.
  • 27-07-2008, 23:14:23
    #7
    Enis adlı üyeden alıntı: mesajı görüntüle
    Arkadaslar ikinizede cok tesekkur ederim gevv'in 2. verdigi kod calisti.
    birde ilk verdiğim css kodları ile gösterim daha iyi olabilir css dosyasına eklediğiniz kodları silmeyin yeni kodları aşağıdaki gibi ekleyin


    	<div class="relatedposts">
    <h3>İlgili Yazılar</h3>
    <?php
    $this_post = $post;
    $category = get_the_category(); $category = $category[0]; $category = $category->cat_ID;
    $posts = get_posts('numberposts=5&offset=0&orderby=post_date&order=DESC&category='.$category);
    $count = 0;
    foreach ( $posts as $post ) {
    if ( $post->ID == $this_post->ID || $count == 5) {
    unset($posts[$count]);
    }else{
    $count ++;
    }
    }
    ?>
    <?php if ( $posts ) : ?>
    <ul>
    <?php function getWords($text, $limit) {
    $array = explode(" ", $text, $limit +1);
    if(count($array) > $limit) {
    unset($array[$limit]);
    }
    return implode(" ", $array); }
    ?>
    <?php foreach ( $posts as $post ) : ?>
    <?php $mycontent = strip_tags($post->post_content);
    $excerpt = getWords($mycontent, 15);
    $a_title = $excerpt . "..."; ?>
    <li><a href="<?php the_permalink(); ?>" title="<?php echo $a_title ?>">
    <?php if ( get_the_title() ) { the_title(); } else { echo "Untitle"; } ?></a>
    <?php endforeach // $posts as $post ?>
    </ul>
    <?php endif // $posts ?>
    <?php
    $post = $this_post;
    unset($this_post);
    ?>
    
    </div>
    sonrasında css dosyasındaki kodlar ile oynama ekleme çıkartma ile değişik görünümler yapılabilir

    numberposts=5 değerini arttırdığınızda görünen yazı sayısı artar
  • 27-07-2008, 23:18:45
    #8
    gevv adlı üyeden alıntı: mesajı görüntüle
    birde ilk verdiğim css kodları ile gösterim daha iyi olabilir css dosyasına eklediğiniz kodları silmeyin yeni kodları aşağıdaki gibi ekleyin
    	<div class="relatedposts">
    <h3>İlgili Yazılar</h3>
    <?php
    $this_post = $post;
    $category = get_the_category(); $category = $category[0]; $category = $category->cat_ID;
    $posts = get_posts('numberposts=5&offset=0&orderby=post_date&order=DESC&category='.$category);
    $count = 0;
    foreach ( $posts as $post ) {
    if ( $post->ID == $this_post->ID || $count == 5) {
    unset($posts[$count]);
    }else{
    $count ++;
    }
    }
    ?>
    <?php if ( $posts ) : ?>
    <ul>
    <?php function getWords($text, $limit) {
    $array = explode(" ", $text, $limit +1);
    if(count($array) > $limit) {
    unset($array[$limit]);
    }
    return implode(" ", $array); }
    ?>
    <?php foreach ( $posts as $post ) : ?>
    <?php $mycontent = strip_tags($post->post_content);
    $excerpt = getWords($mycontent, 15);
    $a_title = $excerpt . "..."; ?>
    <li><a href="<?php the_permalink(); ?>" title="<?php echo $a_title ?>">
    <?php if ( get_the_title() ) { the_title(); } else { echo "Untitle"; } ?></a>
    <?php endforeach // $posts as $post ?>
    </ul>
    <?php endif // $posts ?>
    <?php
    $post = $this_post;
    unset($this_post);
    ?>
    </div>
    sonrasında css dosyasındaki kodlar ile oynama ekleme çıkartma ile değişik görünümler yapılabilir
    Ilgilendiginiz icin gercekten cok tesekkur ederim dediginiz gibi bu kodla daha iyi oldu.
  • 28-07-2008, 06:42:26
    #9
    gevv adlı üyeden alıntı: mesajı görüntüle
    birde ilk verdiğim css kodları ile gösterim daha iyi olabilir css dosyasına eklediğiniz kodları silmeyin yeni kodları aşağıdaki gibi ekleyin
    	<div class="relatedposts">
    <h3>İlgili Yazılar</h3>
    <?php
    $this_post = $post;
    $category = get_the_category(); $category = $category[0]; $category = $category->cat_ID;
    $posts = get_posts('numberposts=5&offset=0&orderby=post_date&order=DESC&category='.$category);
    $count = 0;
    foreach ( $posts as $post ) {
    if ( $post->ID == $this_post->ID || $count == 5) {
    unset($posts[$count]);
    }else{
    $count ++;
    }
    }
    ?>
    <?php if ( $posts ) : ?>
    <ul>
    <?php function getWords($text, $limit) {
    $array = explode(" ", $text, $limit +1);
    if(count($array) > $limit) {
    unset($array[$limit]);
    }
    return implode(" ", $array); }
    ?>
    <?php foreach ( $posts as $post ) : ?>
    <?php $mycontent = strip_tags($post->post_content);
    $excerpt = getWords($mycontent, 15);
    $a_title = $excerpt . "..."; ?>
    <li><a href="<?php the_permalink(); ?>" title="<?php echo $a_title ?>">
    <?php if ( get_the_title() ) { the_title(); } else { echo "Untitle"; } ?></a>
    <?php endforeach // $posts as $post ?>
    </ul>
    <?php endif // $posts ?>
    <?php
    $post = $this_post;
    unset($this_post);
    ?>
    </div>
    sonrasında css dosyasındaki kodlar ile oynama ekleme çıkartma ile değişik görünümler yapılabilir
    Saolasın benımde ısıme yarada başlık yok bunda ama olsun +r tesekkurler