Support » Fixing WordPress » how to limit the size of the post on frontpage

  • I am looking for a place in the admin section to adjust how long each post on the frontpage is. Is there a setting to limit the length and add a more more tag?

    thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi,

    Please use this function to set the max number of post on home page..

    From ALl Categories:

    <?php
    $page_num = $paged;
    if ($pagenum='') $pagenum =1;
    query_posts('showposts=7&paged='.$page_num); ?>
                   	<?php if (have_posts()) : ?>
    		<?php while (have_posts()) : the_post(); ?>
                    endwhile;endif;
    ?>

    From Specific Categories:

    <?php
    $page_num = $paged;
    if ($pagenum='') $pagenum =1;
    query_posts('cat=1&showposts=7&paged='.$page_num); ?>
                   	<?php if (have_posts()) : ?>
    		<?php while (have_posts()) : the_post(); ?>
                    // WordPress loop
                    endwhile;endif;
    ?>

    use this code in index.php file of your there…

    Thanks,

    Shane G.

    Thanks for that code, but I need to limit the size of the post, such as 350 characters and have a read more for the rest of it.

    can this be done?

    click the “more” tab in the html editor where you want to break the post. Using the “excerpt” tag in your php breaks a post at 55 characters. I know of no way to set it to break at another number autotmatically.

    Is there a way to do this without the “More” button? I have Contributors on my site and I would like to be able to automatically limit the size of the post on the home page.

    Thanks!

    There has to be a setting for this.

    Somebody please help us.

    Thanks

    Hey guys,

    Here is a plugin that automatically limits the post lengths on the homepage:

    http://wordpress.org/extend/plugins/wp-limit-posts-automatically/

    Hope that helps.

    Maybe try using <?php the_excerpt(); ?> instead of <?php the_content(); ?> on the main page?

    If you don’t enter text in the excerpt area, it will just use a chunk of the beginning of the post with a […] at the end.

    Not sure if there’s a way to configure the number of characters this uses, though.

    From the Codex:
    Control Excerpt Length using Filters

    By default, excerpt length is set to 55 words. To change excerpt length using excerpt_length filter, add the following code to functions.php file in your theme:

    function new_excerpt_length($length) {
    	return 20;
    }
    add_filter('excerpt_length', 'new_excerpt_length');

    http://codex.wordpress.org/Template_Tags/the_excerpt#Control_Excerpt_Length_using_Filters

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘how to limit the size of the post on frontpage’ is closed to new replies.