انجمن


نمایش حداکثر 200 کاراکتر برای هر پست  (۲ نوشته)

  • toofaan

    آفلاین
    عضو
    تعداد نوشته‌ها: ۵۱
    تشکر شده: ۱ بار
    # نوشته شده: ۱۵ سال پیش
    ۲۱ فروردین ۱۳۸۸ - ۰۲:۱۵

    با سلام
    من میخواستم ببینم چطور برای صفحات index,category,archive.php کاری کنم که بجای نمایش کل مطلب حداکثر مثلا 200 کاراکتر اول پست بصورت اتومات نشان داده شود.
    این از کد صفحه index :

    <?php get_header(); ?>
    <!--#content:start-->
        	<div id="content">
            <?php
            $delicious = get_option('crybook_delicious_uri');
    		if (have_posts()) :
    		while (have_posts()) : the_post();
    		?>
            <div class="entry" id="post-<?php the_ID(); ?>">
    
                	<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                    <p class="meta-header"><?php _e("Posted on the"); ?> <?php the_time('F jS, Y') ?> under <?php the_category(',') ?> by <?php the_author_posts_link(); ?> <?php edit_post_link(__('<span class="edit">Edit</a>')); ?></p>
    
                    <?php the_content(__('')); ?>
    
                    <div class="meta-footer">
                    	<ul>
                            <li><a href="<?php the_permalink() ?>">Read More</a></li>
                            <li><a href="<?php the_permalink() ?>#comment"><?php comments_number(); ?></a></li>
                            <?php edit_post_link(__('Edit'), '<li>', '</li>'); ?>
                        </ul>
                     <div class="clear-left"></div>
    				</div>
    
            	</div>
            <?php endwhile; ?>
            <?php endif; ?>
    			<div class="pagination">
                    <div class="prev-page"><?php next_posts_link('Older Entries') ?></div>
                    <div class="next-page"><?php previous_posts_link('Newer Entries') ?></div>
                </div>
            </div>
    <!--#content:end-->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    با سپاس

  • آرمان

    آفلاین
    عضو
    تعداد نوشته‌ها: ۳۷۳
    تشکر شده: ۲۷ بار
    # نوشته شده: ۱۵ سال پیش
    ۲۱ فروردین ۱۳۸۸ - ۱۲:۱۲

    دوست عزیز،قبل از زدن تاپیک جستجو کنید.
    کد زیر رو جایگزین کنید:

    <?php get_header(); ?>
    <!--#content:start-->
        	<div id="content">
            <?php
            $delicious = get_option('crybook_delicious_uri');
    		if (have_posts()) :
    		while (have_posts()) : the_post();
    		?>
            <div class="entry" id="post-<?php the_ID(); ?>">
    
                	<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                    <p class="meta-header"><?php _e("Posted on the"); ?> <?php the_time('F jS, Y') ?> under <?php the_category(',') ?> by <?php the_author_posts_link(); ?> <?php edit_post_link(__('<span class="edit">Edit</a>')); ?>
    
                <?php the_content_rss('', TRUE, '', 200); ?>
    
                    <div class="meta-footer">
                    	<ul>
                            <li><a href="<?php the_permalink() ?>">Read More</a></li>
                            <li><a href="<?php the_permalink() ?>#comment"><?php comments_number(); ?></a></li>
                            <?php edit_post_link(__('Edit'), '<li>', '</li>'); ?>
                        </ul>
                     <div class="clear-left"></div>
    				</div>
    
            	</div>
            <?php endwhile; ?>
            <?php endif; ?>
    			<div class="pagination">
                    <div class="prev-page"><?php next_posts_link('Older Entries') ?></div>
                    <div class="next-page"><?php previous_posts_link('Newer Entries') ?></div>
                </div>
            </div>
    <!--#content:end-->
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

درباره‌ی این موضوع



برچسب‌ها