In functions.php:
function myExcerpt($text) {
$text = str_replace(']]>', ']]>', $text);
$text = strip_tags($text);
$excerpt_length = 50; // max number of words
$words = explode(' ', $text, $excerpt_length + 1);
array_pop($words);
array_push($words, '-N');
$text = implode(' ', $words);
return $text;
}
In your loops:
echo myExcerpt ( get_the_content() );
Related Posts:
- How to change the order (priority) of registered filters (or actions) (e.g. for the_content)?
- add_action(), add_filter() before or after function
- Trouble understanding apply_filters()
- wp_headers vs send_headers. When to use each?
- How to appending to the_content using add_filter with custom post type?
- How many filter/action hooks are healthy?
- WordPress Internal @ Mentions
- Where to hook into post content?
- Valid characters for actions, hooks and filters
- Is it possible to use object in add_action?
- Get excerpt from $post->post_content
- Add Class to Specific Paragraph of the_content()
- add_filter for specific pages
- Using variable from one filter in another filter
- Anyway to edit the titlebar of WordPress Widgets in the Admin area?
- How do I know if author field was changed on post save?
- How can I display image metadata?
- Using hooks to place content in theme dynamically
- How to apply content filter permanently?
- How to prepend text to the_content, but after img/shortcode
- PHP5, Inheritance, Singleton – action & filter hook limitations
- Please explain me what the do_action does
- Format content value from DB outside of WordPress filters
- Apply the_title filter to post titles AND backend auto social-sharing plugin, but not nav menu
- add_action uses ‘echo’ add_filter uses ‘return’, why?
- Too many actions/filters!
- Making a class available via actions filters
- How does WordPress call functions attached to a certain action hook before calling functions attached to other hooks
- How to get current action?
- Return array of images after content
- how to change appearence of the content of default post list columns?
- Nested calls the the_content filter
- Filter list by a unique meta value dilemma
- return values from hooks do_action and apply_filters, which is better
- How to get all the predefined do_action() calls from an active theme
- Is it possible to track down Actions and Filters?
- Return a custom value in a function added to an action hook
- Is possible dequeue/remove style from wp_footer() hook and add on wp_head() hook?
- Wrap h1-h6 in a div
- add filter login_redirect does not contain original requested redirect
- get_header and hook avoid normal call
- Removing an action, or dequeueing style – Both not working
- Function the_content not working
- Is there a filter called ‘network_admin_init’?
- How to add ‘total’ value to custom column title on the posts list page
- Filter taxonomy admin pagination
- When to use add_action when registering/enqueuing scripts
- ‘the_content’ filter removing html tags from post content
- Are there actions or filters I can use for Ajax calls?
- Post Content, Special Characters and Filters
- Correct method of redirecting user login
- How to properly modify WP Vary or any existing headers?
- Building a request processor for multi-page forms, etc using $_GET requests
- Proper after_setup_theme and wp_head cleanup
- Replace audio links with jplayer using the_content filter
- Add a div of content within the_content after a certain block
- How can I output all apply_filters and do_action?
- How to allow code block in wordpress comments
- Can i use multiple ‘the_content’ filters?
- remove_action: how to access to a method in an child class?
- Filter for when the post is updated
- What is the earliest hook to modify post content?
- Filter get_page_by_path()
- Remove actions/filters that are set with create_function()
- Get The Caller (Plugin / Theme / Core) For All actions & Hook in WordPress
- Alter existing page contents based on url
- Add/remove CRON action depending on variable
- How to access page variable inside action hook
- How to include add_filter() in a condition based on $post data
- Admin: how to make a custom list filter button send GET queryvars
- Use has_filter on comment_post
- Echo string in admin panel footer beside version no
- How to change default text for specific post type
- How can I get the default content of WordPress post?
- How would I use a filter to remove header banner on certain post types
- output custom Posts on a Page
- Replace Data In Post & Update Meta Field Post Is Saved
- Scanning for custom embed and prefetching
- the_content getting current page content instead specified ID
- How to redirect a unique link based on login status
- get_post() with filters applied
- Hook to change the site URL
- Hook to add content after date in post?
- add_action with associative array
- how to use apply filter for Class?
- How can I see exactly what arguments are being passed through a filter so that I may modify them?
- WordPress set featured image to first image of the post
- Set Microsoft Word links to open in new window/tab
- Does anybody know what the $current_screen ->id for customizer.php is?
- How do I isolate the reason a wordpress filter is not running?
- What problems could happen if I replaced add_filter and add_action with the function calling
- Custom search fields and AJAX support
- Adding to an array & passing it through do_action/apply_filters
- Can’t get content of all (19) posts – Incomplete Chunked Encoding
- Updating User Profile on Registration
- can’t output gray scaled image I’ve created using add_image_size
- filter on the_content stopped working when I updated to WP 3.6.1
- Is it possible to make get variable out of filter in Class?
- Replace image scr with it’s surrounding href
- GET form action. Redirect to self