you made it complex a bit i used this simple lines of code;
add_filter('excerpt_length', function ($length) {
global $post;
if ($post->post_type == 'portfolio'){
return 13;
}
return 50;
}, 100);
Related Posts:
- Tips for using WordPress as a CMS? [closed]
- Adding a Taxonomy Filter to Admin List for a Custom Post Type?
- Custom Post Type Templates from Plugin Folder?
- Implementing a CrunchBase.com Clone using WordPress?
- Custom media upload content for inserting custom post shortcode
- Redesigning Custom Post Type “Add New” page
- How to Remove Certain Screen Options and Meta Boxes from add/edit post type?
- How to share category taxonomy with custom post type (The Event Calendar plugin)
- Is it possible to define a template for a custom post type within a plugin independent of the active theme?
- How to get a variable number of posts per post type on the main loop?
- WP_query parameters for date range
- Use a plugin to handle custom post types?
- How Do I Use The WordPress Plugin Posts 2 Posts by Scribu?
- Creating a default Custom Post Template that a Theme can override
- Jetpack plugin (ShareDaddy): Prevent share buttons showing on custom post types?
- Getting Custom Post Type content from main-site of a Multisite
- Cannot strip JW Player shortcode?
- Custom database or Custom Post Types?
- How to make a list of companies’ information and display them to user, using custom post types and a custom taxonomy?
- Aggregate Summaries of Posts of Different Blogs in Multisite Instance
- Custom comment type maybe?
- Register Custom Post Type from Plugin
- Prevent page slug from interfering with custom post type archive permalink?
- Add .html extension to custom post type taxonomies
- How to load a new template page according to a particular URL?
- How Can the_post Be Hooked Like the_content and the_excerpt?
- Update Plugin Without Overwriting Custom Settings
- Calling an custom field from theme option at the frontend
- Array to string conversion error when trying to POST multidimensional array
- Hide some portion on single.php base on author
- Using “excerpt_more” filter for a specific post type
- Creating themes using the one Plugin (Toolkit)
- Displaying image from a repeatable group
- How to add jquery to my custom post type wp plugin
- WordPress list child pages of custom post type
- WordPress custom posttype meta values doesnot save
- Assigning a custom post type to a custom page
- CPT-onomies CPT_TAXONOMY->get_terms extremely slow with 6K posts
- get recent 12 days post then random in wordpress
- making a glossary with wordpress
- Add Excerpt On Quicksand Plugin
- Create custom fields on a post
- Custom Post type plugin breaking the front page shows dashboard?
- What method should I use for a sidebar widget that reads latest posts?
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- Get content or excerpt of top rated votes @GD-Star Rating? [closed]
- Insert data in custom table during new post creation
- get_option include in my adsense
- WordPress Custom post type won’t save properly
- Top Contributors Plugin with Custom Post Type
- How can i do custom author list?
- Making a Custom Post Type Publish Loop
- featured image problem with custom post type
- How can I default a new post to being saved?
- WordPress User Frontend Editing Custom Fields
- How to list the categories by custom taxonomy created?
- Is a custom post type considred a plugin?
- Remove base from the custom post type URL [duplicate]
- Is an Office a custom post type [closed]
- Creating a press page for our project
- Make a magic tag work with Custom Post Types
- Change the behaviour of archive cpt category and single cpt by plugin, not by theme
- A plugin for software reviews site like this one?
- Snippet displaying LearnDash parent course title with lesson title [closed]
- How to laod wp_enqueue_style to another header i created my self
- Display Custom Post Type and Custom Taxonomy Data on Front End Using Only a Plugin
- Looking for a plugins for organization portal (Staff, Units, Departments)? [closed]
- WordPress show different custom post type
- Filter custom post type returned from REST api
- Links not opening as they should. Custom WP plugin
- Wrong block appender button showing
- Select posts from list and add them in a new list
- jet engine listing for every single taxonomy in post type [closed]
- How to export post tags from wordpress
- Failed to update a post when I add a taxonomy to it
- How to access the page without registering in wordpress
- CPT template is not being automatically used single post pages
- How to make content as required in custom post type?
- Set the title of a custom post automatically by using info from custom fields?
- public custom posts not showing in my wordpress plugin
- plugin translation *.mo file not getting loaded for custom post
- How to provide page_template path in custom plugin using WordPress
- Create CPT on Ajax Call
- How to add CPT in Elementor pro search template
- how to compare date meta value in jet smart filter Date query?
- My site has only one page, and users access my uploaded mp3 files from there – can I analyze access by song title?
- Tickera missing attendees – No attendees found
- Include theme header and footer in custom plugin
- How to fetch WordPress Gallery Images to a Custom Post Type?
- Disable All In One SEO plugin for custom post type
- How to disallow users to edit other’s posts for a new custom post type?
- Remove H1 title in admin post edit screen
- How to include Font Awesome icons into ‘menu_icon’ from register_post_type() function – wp admin?
- PHP Fatal error: Cannot redeclare distance() when making a new block
- How to check if the post exists in any of the categories?
- How do I know if an archive correspond to a custom post type taxonomy?
- Keep the expansible tree (list of posts) open in the sidebar
- How to Display News in a Timeline with Headline, Category, and Time?
- Load a custom post type template.html from a plugin
- Query Custom Post Types on Available Dates