How to reduce the number of words per article on Archive page

Discussion in 'WordPress' started by port2684, Dec 11, 2011.

  1. #1
    How can I reduce the number of words per article to be displayed on Archives on my wordpress blog? I just want to limit it to max display it up to 20 to 30 words in the main page of archive for further reading I want users to continue with the ‘More reading’ or ‘continue’ option. Thanks!
     
    port2684, Dec 11, 2011 IP
  2. lamvt

    lamvt Active Member

    Messages:
    153
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Depending on your theme function
    add functions.php ( example: http://joomquery.com/wp-content/themes/vinaora/includes/custom-functions.php )

    add: Get limit excerpt
    // Get limit excerpt
    function 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(']]>', ']]>', $content);
        $content = strip_tags($content);
    
       if (strlen($_GET['p']) > 0) {
          echo "";
          echo $content;
          echo "...";
       }
       else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
            $content = substr($content, 0, $espacio);
            $content = $content;
            echo "";
            echo $content;
            echo "...";
       }
       else {
          echo "";
          echo $content;
       }
    }
    Code (markup):
    and in your loop.php ( example: http://joomquery.com/wp-content/themes/vinaora/includes/templates/loop.php )

    add
    <!--end .entry-meta-->
        
        <div class="entry-excerpt">
            <?php content_limit('240'); ?>
        </div> <!--end .entry-excerpt-->
    Code (markup):
    Number 240 is 240 characters you can changes it to matches with your blog arhive
    Goodluck
     
    lamvt, Dec 11, 2011 IP
    Ahsanaveed likes this.
  3. port2684

    port2684 Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Really thank you so much, i'm really obliged it has solved the problem :) Good luck to you as well. Thanks!
     
    port2684, Dec 12, 2011 IP
  4. yank whalley

    yank whalley Peon

    Messages:
    70
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Try this one dear. Copy and Paste this following code in function.php file. More information- http://witsgroup.in/wordpress.html

    function custom_excerpt_length( $length )
    {
    return 20;
    }
    add_filter( 'excerpt_length', 'custom_excerpt_length' );
     
    yank whalley, Dec 13, 2011 IP
  5. ninjamtlt1

    ninjamtlt1 Active Member

    Messages:
    1,704
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    88
    #5
    There is an area of Wordpress (I forgot where) where it says "show content limit" for archives.
     
    ninjamtlt1, Dec 17, 2011 IP