Title: 300 Character limit
Last modified: August 19, 2016

---

# 300 Character limit

 *  [bortas](https://wordpress.org/support/users/bortas/)
 * (@bortas)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/300-character-limit/)
 * Ive got a problem, and I have read about in another topic but didnt really got
   that to work.
 * Im having a page where the index is a newspage. And when the news is posted I
   only want 300 character at the index to be displayed. And when you click at the
   title or the “read more” button the the news will be official.

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [xdesi](https://wordpress.org/support/users/xdesi/)
 * (@xdesi)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/300-character-limit/#post-1308009)
 * Is this just one post on your index you want to be cut to 300 characters or all
   posts?
 * I’m assuming it’s all posts, you’d go into your index template (most likley index.
   php), and change [the_content](http://codex.wordpress.org/Template_Tags/the_content)
   to [the excerpt](http://codex.wordpress.org/Template_Tags/the_excerpt)
 * Then in your functions.php file add the following:
 *     ```
       function new_excerpt_length($length) {
       	return 300;
       }
       function excerpt_ellipse($text) {
          return str_replace('[...]', ' <a href="'.get_permalink().'">Read More</a>', $text);
       }
       add_filter('the_excerpt', 'excerpt_ellipse');
       add_filter('excerpt_length', 'new_excerpt_length');
       ```
   
 * The first function changes the amount shown to 300 characters and the second 
   function changes […] to a read more link
 *  Thread Starter [bortas](https://wordpress.org/support/users/bortas/)
 * (@bortas)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/300-character-limit/#post-1308019)
 * I Have paste the function into the funtcions.php
 * My code at the index looks like this.
 *     ```
       <?php if (have_posts()) : ?>
       <?php
       $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
       $args= array(
       	'cat' => 4,
       	'paged' => $paged
       );
       query_posts($args);
       ?>
       <?php while (have_posts()) : the_post(); ?>
       ```
   
 * Where should i add eh exceprt?
 *  [Rev. Voodoo](https://wordpress.org/support/users/rvoodoo/)
 * (@rvoodoo)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/300-character-limit/#post-1308020)
 * it goes in index.php
 * are you altering a theme, or creating one?
 * if altering a theme, in index.php you may just replace the call to the_content
   with the_excerpt
 * edit…sorry, I misread, and thought the above code was from functions.php, so 
   my reply makes little to no sense….
 *  Thread Starter [bortas](https://wordpress.org/support/users/bortas/)
 * (@bortas)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/300-character-limit/#post-1308024)
 * Its my design yes… So the index doesnt really look like anotther index.php
 *  [xdesi](https://wordpress.org/support/users/xdesi/)
 * (@xdesi)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/300-character-limit/#post-1308032)
 * Somewhere underneath the line you posted in index.php:
 * `<?php while (have_posts()) : the_post(); ?>`
 * You should find the_content(); somewhere, change it to the_excerpt.
 * If you are still struggling post up your index.php file!
 *  Thread Starter [bortas](https://wordpress.org/support/users/bortas/)
 * (@bortas)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/300-character-limit/#post-1308043)
 * I solved it, thanks alot! (Y)
 *  [xdesi](https://wordpress.org/support/users/xdesi/)
 * (@xdesi)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/300-character-limit/#post-1308049)
 * No problemo
 *  [axelav](https://wordpress.org/support/users/axelav/)
 * (@axelav)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/300-character-limit/#post-1308259)
 * Hi xdesi,
 * I followed your instructions but it doesn’t seem to have changed anything. Here’s
   my functions.php file:
 *     ```
       <?php
   
       function new_excerpt_length($length) {
       	return 125;
       }
       function excerpt_ellipse($text) {
          return str_replace('[...]', ' <a href="'.get_permalink().'">[More...]</a>', $text);
       }
       add_filter('the_excerpt', 'excerpt_ellipse');
       add_filter('excerpt_length', 'new_excerpt_length');
   
       ?>
       ```
   
 * And this is what I have in my index.php file:
 *     ```
       <?php while (have_posts()) : the_post(); ?>
   
       				<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
       					<h4><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h4>
       					<small><?php the_time('F jS, Y g:ia') ?></small>
       					<div class="news-entry">
       						<?php the_excerpt(); ?>
       					</div>
       				</div>
   
       			<?php endwhile; ?>
       ```
   
 * Thanks!
 *  [axelav](https://wordpress.org/support/users/axelav/)
 * (@axelav)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/300-character-limit/#post-1308260)
 * Oye I sorted it out. The number the first function returns is words, not characters.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘300 Character limit’ is closed to new replies.

## Tags

 * [character](https://wordpress.org/support/topic-tag/character/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 4 participants
 * Last reply from: [axelav](https://wordpress.org/support/users/axelav/)
 * Last activity: [16 years, 1 month ago](https://wordpress.org/support/topic/300-character-limit/#post-1308260)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
