• 29-07-2010, 01:14:36
    #1
    Arkadaşlar belirttiğimiz bir kategoriden son 5 adet konuyu resimli bir şekilde <ul>,<li> kullanarak nasıl gösterebiliriz. Bu konuda yardımcı olabilir misiniz? Eklentilerin hepsine baktım neredeyse, son konular var fakat resimli değil.

    Bu konuda yardımcı olabilirseniz çok sevinirim, eğer çok zor birşeyse ücretli olarakta yaptırmayı düşünüyorum. Fakat çok acil bir durum.
  • 29-07-2010, 15:49:15
    #2
    Emin olmamakla birlikte şöyle birşey sunabilirim size;

    <h3>Resimli Kategori</h3>
    			
    				<!--Resimli Kategori ID #1, olarak ayarlıdır cat=1 olarak ayarlanmıştır category ID numarasını değiştirin -  custom field ismi  "thumbnail". resim boyutu 70x70, olması gerekir.-->
    	<ul>		
    				<?php $recent = new WP_Query("cat=1&showposts=3"); while($recent->have_posts()) : $recent->the_post();?>
    				<?php if( get_post_meta($post->ID, "thumbnail", true) ): ?>
    				    <a href="<?php the_permalink() ?>" rel="bookmark"><img style="float:left;margin:0px 10px 0px 0px;" src="<?php echo get_post_meta($post->ID, "thumbnail", true); ?>" alt="<?php the_title(); ?>" width="70" height="70"/></a>
    				<?php else: ?>
    				   	<a href="<?php the_permalink() ?>" rel="bookmark"><img style="float:left;margin:0px 10px 0px 0px;"  src="<?php bloginfo('template_url'); ?>/images/thumbnail.png" alt="<?php the_title(); ?>" /></a>
    				<?php endif; ?>				
    				<b><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></b>
    				<?php the_content_limit(80, ""); ?>
    				
    				<div style="border-bottom:1px dotted #94B1DF; margin-bottom:10px; padding:0px 0px 10px 0px; clear:both;"></div>
    				
    				<?php endwhile; ?>
            </ul>
    Umarım doğrudur. Kolay gelsin..
  • 29-07-2010, 19:15:00
    #3
    Verdiğiniz kodu index.php'de uygun bir yere yerleştirdim. Fakat aşağıdaki hata ekrana yansıyor.

  • 29-07-2010, 22:19:09
    #4
    <?php function the_content_limit($max_char, $more_link_text = '(Okumaya devam et...)', $stripteaser = 0, $more_file = '') {
        $content = get_the_content($more_link_text, $stripteaser, $more_file);
        $content = apply_filters('the_content', $content);
        $content = str_replace(']]>', ']]&gt;', $content);
        $content = strip_tags($content);
    
       if (strlen($_GET['p']) > 0) {
          echo "<p>";
          echo $content;
          echo "&nbsp;<a href='";
          the_permalink();
          echo "'>"."Okumaya devam et &rarr;</a>";
          echo "</p>";
       }
       else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
            $content = substr($content, 0, $espacio);
            $content = $content;
            echo "<p>";
            echo $content;
            echo "...";
            echo "&nbsp;<a href='";
            the_permalink();
            echo "'>".$more_link_text."</a>";
            echo "</p>";
       }
       else {
          echo "<p>";
          echo $content;
          echo "&nbsp;<a href='";
          the_permalink();
          echo "'>"."Okumaya devam et &rarr;</a>";
          echo "</p>";
       }
    }
    
    ?>
    functions.php dosyanızın en altına şunları ekleyin arkadaşın verdiği kodları ekledikten sonra çalışması lazım
  • 29-07-2010, 22:47:46
    #5
    Benden birkaç sani önce yazmışsın. Ben halletmiştim teşekkür ederim. Ayrıca tam çalışır kodları ekleyeyim thumbnail vb içerisinde var.

    function the_content_limit($max_char, $more_link_text = '', $stripteaser = 0, $more_file = '') {
        $content = get_the_content($more_link_text, $stripteaser, $more_file);
        $content = apply_filters('the_content', $content);
        $content = str_replace(']]>', ']]&gt;', $content);
        $content = strip_tags($content);
    
       if (strlen($_GET['p']) > 0) {
          echo "";
          echo $content;
          echo "&nbsp;<a href='";
          the_permalink();
          echo "'>"."Devam &rarr;</a>";
          echo "";
       }
       else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
            $content = substr($content, 0, $espacio);
            $content = $content;
            echo "";
            echo $content;
            echo "...";
            echo "&nbsp;<a href='";
            the_permalink();
            echo "'>"."Devam &rarr;</a>";
            echo "";
       }
       else {
          echo "";
          echo $content;
          echo "&nbsp;<a href='";
          the_permalink();
          echo "'>"."Devam &rarr;</a>";
          echo "";
       }
    }
    
    function get_thumbnail($postid=0, $size='full') {
        if ($postid<1)
        $postid = get_the_ID();
        $thumb = get_post_meta($postid, "thumbnail", TRUE);
        if ($thumb != null or $thumb != '') {
            echo $thumb;
        }
        elseif ($images = get_children(array(
            'post_parent' => $postid,
            'post_type' => 'attachment',
            'numberposts' => '1',
            'post_mime_type' => 'image', )))
            foreach($images as $image) {
                $thumbnail=wp_get_attachment_image_src($image->ID, $size);
                ?>
    <?php echo $thumbnail[0]; ?>
    <?php
            }
        else {
            echo get_bloginfo ( 'stylesheet_directory' );
            echo 'resim-bulamadim.gif';
        }
       
    }
    ?>
  • 30-07-2010, 01:50:59
    #6
    ogogi adlı üyeden alıntı: mesajı görüntüle
    Benden birkaç sani önce yazmışsın. Ben halletmiştim teşekkür ederim. Ayrıca tam çalışır kodları ekleyeyim thumbnail vb içerisinde var.

    function the_content_limit($max_char, $more_link_text = '', $stripteaser = 0, $more_file = '') {
        $content = get_the_content($more_link_text, $stripteaser, $more_file);
        $content = apply_filters('the_content', $content);
        $content = str_replace(']]>', ']]&gt;', $content);
        $content = strip_tags($content);
    
       if (strlen($_GET['p']) > 0) {
          echo "";
          echo $content;
          echo "&nbsp;<a href='";
          the_permalink();
          echo "'>"."Devam &rarr;</a>";
          echo "";
       }
       else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
            $content = substr($content, 0, $espacio);
            $content = $content;
            echo "";
            echo $content;
            echo "...";
            echo "&nbsp;<a href='";
            the_permalink();
            echo "'>"."Devam &rarr;</a>";
            echo "";
       }
       else {
          echo "";
          echo $content;
          echo "&nbsp;<a href='";
          the_permalink();
          echo "'>"."Devam &rarr;</a>";
          echo "";
       }
    }
    
    function get_thumbnail($postid=0, $size='full') {
        if ($postid<1)
        $postid = get_the_ID();
        $thumb = get_post_meta($postid, "thumbnail", TRUE);
        if ($thumb != null or $thumb != '') {
            echo $thumb;
        }
        elseif ($images = get_children(array(
            'post_parent' => $postid,
            'post_type' => 'attachment',
            'numberposts' => '1',
            'post_mime_type' => 'image', )))
            foreach($images as $image) {
                $thumbnail=wp_get_attachment_image_src($image->ID, $size);
                ?>
    <?php echo $thumbnail[0]; ?>
    <?php
            }
        else {
            echo get_bloginfo ( 'stylesheet_directory' );
            echo 'resim-bulamadim.gif';
        }
       
    }
    ?>
    bu kodu nereye ekliyeceğiz tam bilgi verebilirmisiniz.