Yep, wp_trim_words()
:
<?php $trimmed = wp_trim_words( $text, $num_words = 55, $more = null ); ?>
Or in your case:
<?php echo apply_filters( 'the_content', wp_trim_words( strip_tags( $post->post_content ), 55 ) ); ?>
Related Posts:
- Extract image from content and set it as the featured image
- Edit the_content function
- Remove image from post_content on save_post
- Make WordPress size and name images for Retina.js
- Pinterest Integration Using functions.php
- Template tags vs get_template_part() vs functions.php
- Allowing SVG uploads in media uploader without plug-in
- Unable to get_the_content(); of a post in WordPress via AJAX
- ‘is’ functions and ‘get_query_var’ not working
- Automatically wrap multiple images in div
- How can I add text to all posts/pages/categories/homepage etc
- Display post shortcode content in the sidebar?
- WordPress menu link doesn’t work properly
- If user is logged-in display/hide something
- Tags break custom Excerpt function
- Function to echo (or display?) wordpress tags in the head section
- the_excerpt function not showing image
- method to fetch entire tag list on archive.php
- What is best practices to move the following code into a function?
- Regex works in regexr, but not if I filter content [closed]
- Problem in outputting shortcode
- Problem in shortcode outputting content
- Why don’t some template tags work when querying information on single.php?
- Integrating custom API for post content into Admin interface & Public Website [closed]
- Trying to get this function to show below the content
- Missing feature image link function
- How to customize the_archive_title()?
- Get menu object from theme_location
- Displaying the number of updates available in the Admin area
- Trying to use add_action and do_action with parameters
- Safe to disable wptexturize?
- Get a list of all available fields in the User Profile
- How do I use the WP image functions in a page template?
- Targeting specific menu with wp_nav_menu_items
- why doesnt is_home() work in functions.php
- Insert Ad Code in the Middle of a Post
- Add options to featured image
- disable comments if array exists
- WordPress Change Post Templates,but not drop down, but Image selection
- Programmatically Add Font-Awesome Icons to Category Widget
- Remove images from get_the_excerpt
- Remove “says” from comments
- Reuse variable in hook callback
- Dynamically Register Sidebars For Each Top Level Page
- Run Product Filter Javascript On Page Template
- Changes to functions.php not working
- Custom excerpt legnths for specific pages
- How to Add a Random Custom Gravatar in the WordPress Comments?
- Remove default user registration, login and subscriber profiles
- How to mass-delete inline styles in WordPress custom post type automatically?
- Include files in child themes, declare in functions.php
- Display first name of logged in user?
- functions.php mistakenly deleted
- Identical custom taxonomy slugs for same hierarchical children
- add code in functions.php will slow down the Execution speed?
- Custom Post excerpt not working correctly
- Wait a result before enqueue
- Function added using `add_action()` not being called
- How to pass variables from a function in functions.php to an other one
- How to change this simple code so that it sends the email notification after payment in WooCommerce?
- Add code to Functions.php
- How can we know we are not in edit page
- Adding jQuery datepicker to Custom Post Type Metabox [closed]
- Allowed memory size of 33554432 bytes exhausted (tried to allocate 9967617 bytes) in …\wp-includes\functions.php
- What happens to the text in functions.php file outside of the php enclosure?
- wordpress acts like functions.php doesn’t exist [closed]
- retrieves menu and converts it to a readable array
- How can I pass a shortcode value to the head in wordpress functions.php
- WordPress can’t get jquery/unslider to work
- Replace admin header logo with an image
- template_redirect action only firing if logged in
- Unable to use get_page_by_title() more than once per page?
- Featured Image and Tags problem
- Advanced method to control cache of enqueued style/script
- Issue passing action class to nested function. Admin Columns
- Populate Product Regular Price with a calculated ACF Field Value
- large image size of 1440×1440 not pulling 2x of 2880×2880 image
- How to make the RTL.css the dominant css code?
- Auto remove tags on certain date
- get_field() with ID in one signal filter not working
- I’m getting invalid taxonomy in init action
- Is there any requirements to do socket programming with WordPress?
- Only seems to be displaying one child when there are supposed to be multiple
- Rest API User Levels
- adding google analytics via echo or between tags
- Slider Thumbnail Size Issue [closed]
- same get_posts function works diffrently in tag.php and functions.php
- Call custom field using php
- Meta Box value not been pulled in
- How to Update User Meta Field other than from profile?
- Retrieve array of attachment IDs attached to a given Post ID
- add_theme_support not outputting thumbnails
- More link – not text
- update_user_option not working as expected
- PHP Notice: Function is_page was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false
- User’s Comments Number: Storing it in a meta field for different uses
- Show one post per author and order by custom field
- Text before price on WooCom
- Warning: call_user_func_array() expects parameter 1 to be a valid callback
- How to store page-{id}.php templates in custom folder