• 02-11-2009, 23:33:40
    #1
    Header.php dosyasında açıklama bölümü için sizce aşağıdaki kodlardan hangisi daha verimli ve sorunsuz olur

    İki kodda çalışıyor tahminimce en kısa olan daha iyidir


    <?if (is_home()){
        $description = " ";
    } elseif (is_single()){
        if ($post->post_excerpt) {
            $description     = $post->post_excerpt;
        } else {
            $description = substr(strip_tags($post->post_content),0,150);
        }
    }
    ?>
    
    
    <meta name="description" content="<?=$description?>" />


    İkinci kod

    <meta name="description" content="<?php if (is_single() ) {?>
    <?php if ( $posts ) : ?>
    <?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, 19);
    $a_title = $excerpt . " ."; ?><?php echo $a_title ?>
    <?php endforeach // $posts as $post ?>
    <?php endif // $posts ?>
    <?php
    $post = $this_post;
    unset($this_post);
    }?> " />
  • 02-11-2009, 23:53:09
    #2
    Alıntı
    <meta name="description" content="dırım dırım"/>
    bunu kullanıyordum
  • 03-11-2009, 03:09:49
    #3
    Seo eklentisi kurunca otomatik yapıyor zaten bu işlemi

    ama illa manuel yapacam derseniz 1. koddaki gibi konunun belli bir bölümünü description a yazdırabilirsiniz
  • 03-11-2009, 05:56:34
    #4
    bencede birinci kod.

    description olarak ilk 150 harfi yazdırmanız.