<?php the_content_limit(500, ""); ?>Yukarıdaki kodu the_content in yerine yazdığım zaman ana sayfa gösteriminde hata alıyorum. Kod ise yazıların limitini ayarlıyor. yani ilk 500 harfin anasayfada gösterimini sağlıyor diğer kalanı ise konu içerisinde cıkıyor. bir türlü çalıştıramadım kodu. yardımcı olabilecek varmı. Site ise şurası
the_content_limit Hakkında Ufak Bir Soru
12
●1.362
- 17-05-2010, 15:52:01
- 17-05-2010, 16:10:11Üyeliği durdurulduWordpress'e ait böyle bir fonksiyon yok, eklenti yükledikten sonra fonksiyonu kullanabilirsin.
Aşşağıdaki kodları .php uzantılı bir dosya içerisine yaz kaydet ve wp-content/plugins klasörü içine atıp panelden eklentilere gelip aktif et, daha sonra bahsettiğin fonksiyonu kullanabilirsin.
<?php /* Plugin Name: Limit Posts Plugin URI: http://labitacora.net/comunBlog/limit-post.phps Description: Limits the displayed text length on the index page entries and generates a link to a page to read the full content if its bigger than the selected maximum length. Usage: the_content_limit($max_charaters, $more_link) Version: 1.1 Author: Alfonso Sanchez-Paus Diaz y Julian Simon de Castro Author URI: http://labitacora.net/ License: GPL Download URL: http://labitacora.net/comunBlog/limit-post.phps Make: In file index.php replace the_content() with the_content_limit(1000, "more") */ function the_content_limit($max_char, $more_link_text = '(more...)', $stripteaser = 0, $more_file = '') { $content = get_the_content($more_link_text, $stripteaser, $more_file); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); if (strlen($_GET['p']) > 0) { echo $content; } else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) { $content = substr($content, 0, $espacio); $content = $content; echo $content; echo "<a href='"; the_permalink(); echo "'>"."..."."</a>"; echo "<br><br>"; echo "<a href='"; the_permalink(); echo "'>".$more_link_text."</a></p>"; } else { echo $content; } } ?> - 17-05-2010, 16:57:05Üyeliği durdurulduBöyle yapabilirsin ama resimlerin çıktığı yer ile ilgili sorun yaşıcaksın, resim boyutu vs.
<?php get_header(); ?> <?php $options = get_option('blocks2_options'); ?> <?php if ($options['notice'] && $options['notice_content']) : ?> <div class=" <?php if($options['notice_color'] == 1) {echo 'box';} else if($options['notice_color'] == 3){echo 'errorbox';} else{echo 'messagebox';} ?> normalfont"> <?php echo($options['notice_content']); ?> </div><?php endif; ?><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); update_post_caches($posts); ?> <div class="post" id="post-<?php the_ID(); ?>"> <div class="caption"> <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <!-- ratings --> <?php if(function_exists('the_ratings')) { the_ratings(); } ?> <div class="fixed"></div> </div> <div class="meta"> <div class="info"> <?php the_time(__('d M Y', 'blocks2')) ?> <?php if ($options['categories']) : ?> | <?php _e('Categories: ', 'blocks2'); the_category(', '); ?> <?php endif; ?> </div> <div class="comments"><?php comments_popup_link(__('No comments', 'blocks2'), __('1 comment', 'blocks2'), __('% Yorum', 'blocks2')); ?><?php edit_post_link(__('Edit', 'blocks2'), ' | ', ''); ?></div> <div class="fixed"></div> </div> <div class="content"> <?php the_content_limit(500, ""); ?> </div> </div> <?php endwhile; ?> <?php else : ?> <div class="errorbox"> <?php _e('Sorry, no posts matched your criteria.', 'blocks2'); ?> </div><?php endif; ?> <div id="pagenavi"> <?php if(function_exists('wp_pagenavi')) : ?> <?php wp_pagenavi() ?> <?php else : ?> <span class="alignleft floatleft"><?php previous_posts_link(__('« Newer Entries', 'blocks2')); ?></span> <span class="alignright floatright"><?php next_posts_link(__('Older Entries »', 'blocks2')); ?></span> <?php endif; ?> <div class="fixed"></div></div> <?php get_footer(); ?>