You can count the number of words in your text to check if it’s greater than 15 using the str_word_count php function, and if not return your read more link also
So i would modify your custom field excerpt thus:
function custom_field_excerpt() {
global $post;
$text = get_field('description');
if ('' != $text) {
$text = strip_shortcodes($text);
$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
$excerpt_length = 15;
$excerpt_more = apply_filters('excerpt_more', ' ');
$text = wp_trim_words($text, $excerpt_length, $excerpt_more);
}
if (str_word_count($text) > 15)
return apply_filters('the_excerpt', $text);
return apply_filters('the_excerpt', $text) . "<a class="moretag" href="https://wordpress.stackexchange.com/questions/251744/get_permalink($post->ID)"><br>...Read More</a>"
}
Related Posts:
- Filter by custom field in custom post type on admin page
- Media library – Limit images to custom post type
- How do I filter the excerpt metabox description in admin?
- Archive filter disappears on no results?
- Add $more_link_text parameter to the_excerpt()
- How to add a post slug to a url?
- Excerpt length: get first paragraph
- Query filter by value in meta_value array
- Auto generate excerpt from ACF field on a CPT that does not support excerpt or content
- Filter posts by their related field’s custom field
- Adding specific custom fields (images) to post excerpt
- Grouping and paging CPT events by month with custom field date
- Filter Content on all Post Types
- using ACF datepicker to filter posts on a page
- Filter page ID outside the loop and order
- Custom sortable columns ordered by meta-value?
- Filter for “get_post_type_archive_link()”
- wp_query and comment_parent – select only posts with top level comments
- How can I add a column in the wp_list_table of the admin area?
- How to filter the description of a custom post type
- Show ACF field from custom taxonomy and display on the single template
- Get Custom Field Values by Another Custom Field in WordPress
- Filter home_url for custom post type
- Add Content Exclusively to a Custom Post Type Feed
- Show custom field from custom taxanomy term on custom post type
- How to create an array for a CPT post ID to use in an IF/WHILE statement
- Custom Post type with ACF in REST API, how do I get those values?
- How to: Display ACF [fields] on Custom Post Types Utilising WordPress ‘Hooks’? [closed]
- WP_Query to select custom post type with Advanced Custom Fields (ACF) date
- Bulk Update Custom Fields for Custom Post Types
- Cluster CPT posts to users based on ACF value from their profile on dashboard
- ACF Values Don’t Show After Import Unless I Edit/Update Post
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- How to change the post type a theme shows by default?
- filter custom post in rest api with custom function
- Sort and filter custom post type posts by custom taxonomy
- Query Custom Post Type Taxonomy term with multiple parameters
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- Search filter triggered & sort by custom post type
- WebP Fallback for Inline Background Image in Style Attribute
- How can I add a filter to a particular post format?
- Why is my WP Query not returning first result’s post meta?
- custom post data – how to
- Recoverable Fatal Error – Object of class WP_Post could not be converted to string
- How can I remove filters from custom post types?
- How can I add a shortcode to query Custom Post Type with ACF in WordPress?
- ACF for custom post type archive pages: which hook to use?
- How do I replace the post title with a custom field?
- Advanced custom fields Post Object image field not displaying in custom post type single.php
- how to retain the ability to modify the post slug after applying a post_type_link filter?
- Sum and count of custom field values
- How to export custom post type with ACF to individual file with automation?
- Custom Post Type with Configurable Sidebar via ACF
- Get A Custom Field From A Custom Taxonomy Of A Custom Post Type [closed]
- Custom Sidebar in Editor (not Widget) for Custom Post Type in Genesis
- Change Custom Post Type singular_name through function/filter
- Custom field with Types: get custom field’s value label (of type select)
- show most viewed posts of last days by link?
- Using ACF values in nested WP queries for CPT with date values in the past
- Create/populate Custom Posts ACF fields from external JSON file
- WordPress URL rewrites using Advanced Custom Field
- Custom Post Type and Structure Question
- Filter in Custom post type to find the parent post
- Display Custom Field or Custom Taxonomy in front page /post/product
- Why do my custom post types stop displaying over time?
- How to access repeater field of a custom field?
- ACF Pro Accessing fields on a Custom Post Type
- Modify Publish Metabox location on CPT
- Some posts not displaying by taxonomy term
- How can we display full post on home page rather than excerpt
- Add content to wordpress edit.php page
- How to use multiple orderby conditions on query search results? (orderby one post type, relevance)
- pricefilter without WooCommerce
- Display custom tax in “while” loop
- filter rest api post by a acf filed
- Shortcode in excerpt
- ACF Post Content Not Being Searched
- Highlight a Post on archive page if it has a new comment?
- Custom post tag images not displaying with ACF
- Custom post type with Filter and Page Nav
- Converting a checkbox filter for custom fields to a dropdown
- Excert ( the_excerpt(); ) Not working properly
- Get post id of permalink for a specific custom post type?
- Diffrent search templates for different post types
- If you’re calling a dynamic css inline style does that div have to be in the loop?
- If i have custom post type with 5 custom fields do i have to create a new loop to reference each one?
- How to filter posts by categories?
- Copying custom field value in to title
- How to show animal lineage/pedigree in WordPress?
- Custom Post Type Loop breaking php
- Styling first post using Advanced Custom Fields
- How do I filter a custom post type loop by a field?
- A to Z list for custom post types
- ACF Relationship: Group posts by parent category term, then child [closed]
- ACF Field to set Publish Date – Post Duplication upon Update
- Getting ACF relationship field information
- Trying to set up a range filter for related custom post types
- Two custom post type relations
- Change CPT Edit Target Link for Admin List
- selecting custom post types and taxonomies for hub page listing blocks