• 17-08-2015, 14:40:36
    #1
    kod bu

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
    <?php 
    require('wp-config.php' ); 
    function SonYazilar() { 
    global $wpdb; 
    $kac_tane_yazi_gosterilsin = 15; 
    $yazilar = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status ='publish' ORDER BY ID DESC LIMIT 0,$kac_tane_yazi_gosterilsin"); 
    $cikti .= '<ul>'; 
    foreach($yazilar as $yazi){ 
    $yazi_url=get_permalink($yazi->ID); 
    $cikti .='<li><a target="_blank" href="'.$yazi_url.'">'.iconv(get_settings('blog_charset'), "utf-8",$yazi->post_title).'</a></li><br>'; 
    } 
    $cikti .= '</ul>'; 
    echo $cikti; 
    die(); 
    } 
    switch ($_GET['git']) { 
    case 'sonyazilar': 
    SonYazilar(); 
    break; 
    } 
    ?>
    kod bu arkadaşlar ben belli bir kategori idsinden veya isminden çeksin istiyorum mb_substr bu kodda belli bir adete kadar yazı içindeki kelimeleri alıyor.Buda lazım yani title ve içeriği listemek istiyorum.

    --R10.NET; Flood Engellendi -->-> Yeni yazılan mesaj 14:40:36 -->-> Daha önceki mesaj 13:59:35 --

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <?php $xml = simplexml_load_file('http://www.siteismi.com/category/kategoriismi/feed'); ?> 
    <?php     
     $s=0; 
        foreach($xml->channel->item as $item){ 
         if($s<5){ //Burada ki 5 rakamı post sayısını gösteriyor.
          echo '<div style="clear:both;" class="konular"> 
        <h3><strong><a title="'.$item->title.'" target="_blank" href="'.$item->link.'">'.$item->title.'</a></strong></h3> 
        <div style="width:100%;" class="yanmenuyazi">'.mb_substr($item->description,0,100,"UTF-8").'...</div> 
        </div>'; 
         }  
         $s++; 
        } 
    ?>
    bu kodla halllettim arkadaşlar belki faydası olur
  • 17-08-2015, 16:07:58
    #2
    Bahsettiğiniz kendi siteniz ise feedlerle filan uğraşmaya gerek yok.

    // WP_Query arguments
    $args = array (
    	'cat'                    => '15',
    	'pagination'             => true,
    	'posts_per_page'         => '15',
    	'order'                  => 'DESC',
    	'orderby'                => 'date',
    );
    
    // The Query
    $query = new WP_Query( $args );
    
    // The Loop
    if ( $query->have_posts() ) {
    	while ( $query->have_posts() ) {
    		$query->the_post();
    		// do something
    	}
    } else {
    	// no posts found
    }
    
    // Restore original Post Data
    wp_reset_postdata();