• 21-11-2008, 01:36:50
    #1
    Üyeliği durduruldu
    Merhabalar,
    arkadaşlar aşağıdaki kodu kullanarak kategori 1 in içerisindeki son 3 mesajı alabiliyorum.

    	<?php 
    $recent = new WP_Query("(cat=1&showposts=3"); 
    while($recent->have_posts()) : $recent->the_post();
    
    ?>
    3, 4, 5 numaralı kategorilerdeki en son yazılmış olan mesajı nasıl alabilirim.
  • 21-11-2008, 01:52:58
    #2
    $recent = new WP_Query("cat=1&showposts=3");
    cat=1 yazan yeri, cat=1,2,3 gibi değiştir
  • 21-11-2008, 02:10:02
    #3
    Üyeliği durduruldu
    seemsiyah adlı üyeden alıntı: mesajı görüntüle
    $recent = new WP_Query("cat=1&showposts=3");
    cat=1 yazan yeri, cat=1,2,3 gibi değiştir
    Onu biliyorum,
    $recent = new WP_Query("(cat=4&showposts=1"); 
    $recent = new WP_Query("cat=5&showposts=1"); 
    $recent = new WP_Query("cat=6&showposts=1"); 
    $recent = new WP_Query("cat=7&showposts=1"); 
    $recent = new WP_Query("cat=8&showposts=1"); 
    while($recent->have_posts()) : $recent->the_post();
    yapınca 4-5-6-7-8 kategorilerinden birine yazılmış en sonuncu mesaj çıkıyor.
    toplamda her kategoriden 1 mesaj yani 5 mesaj cıkmasını istiyorum.
    $recent1 = new WP_Query("(cat=4&showposts=1"); 
    $recent2 = new WP_Query("cat=5&showposts=1"); 
    $recent3 = new WP_Query("cat=6&showposts=1");
    $recent=$recent1+$recent2+$recent3;
    while($recent->have_posts()) : $recent->the_post();
    gibi birşey yapmayı denedim hata verdi.
  • 21-11-2008, 02:17:17
    #4
    $recent = new WP_Query("cat=1,2,3&showposts=3");
  • 21-11-2008, 02:38:29
    #5
    Üyeliği durduruldu
    seemsiyah adlı üyeden alıntı: mesajı görüntüle
    $recent = new WP_Query("cat=1,2,3&showposts=3");
    saol dostum.Ama işe yaramadı. 1. kategorideki mesajlar en son yazıldığı için sadece bu kategorideki 3 mesajı ekrana getirdi.
    Konuyu şöyle açıklasam,
    1.kategori - aakonusu bbkonusu cckonusu mevcut..
    2.kategori - ddkonusu mevcut..
    3.kategoride - eekonusu ff konusu mevcut.
    Bu kodları yazınca.. Bizim tablomuzda aşağıdaki türden konuların olmasını istiyorum.

    1 .kategoriden son mesajı.
    akonusu
    2.kategoriden son mesajı
    dkonusu
    3.kategoriden son mesajı.
    fkonusu

    2.kategoriye yeni mesaj yazılınca..(gkonusu)
    2 .kategoriden son mesajı.
    gkonusu
    1.kategoriden son mesajı
    akonusu
    3.kategoriden son mesajı.
    fkonusu
    Görüldüğü üzere tabloda sadece her kategoriden en son yazılmış mesajı ekrana getirmesini istiyorum..

    Zaman ayırdığın için saol.
  • 21-11-2008, 16:02:17
    #6
    <?php
    $recent = new WP_Query("cat=9&showposts=1"); while($recent->have_posts()) : $recent->the_post();
        the_title();
    endwhile;
    
    echo "<br />";
    
    $recent = new WP_Query("cat=5&showposts=1"); while($recent->have_posts()) : $recent->the_post();
        the_title();
    endwhile;
    
    echo "<br />";
    
    $recent = new WP_Query("cat=3&showposts=1"); while($recent->have_posts()) : $recent->the_post();
        the_title();
    endwhile;
    ?>