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:
- Adding a Taxonomy Filter to Admin List for a Custom Post Type?
- Implementing a CrunchBase.com Clone using WordPress?
- Custom media upload content for inserting custom post shortcode
- 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?
- Register Custom Post Type from Plugin
- How to get the custom page get_permalink?
- Updating post meta for custom post types
- Template for custom post type shows all posts instead of just one
- Custom Post Type causes Page Not Found
- How Can A Plugin Hook Itself To the End of Every Excerpt?
- Frontend editing, Frontend user dashboard
- Override plugin with functions.php
- Should i delete the posts created by a plugin on uninstall?
- How can I list recent posts excerpts?
- How does WP handle multiple matching rewrite rules?
- Saving Custom Post types and fields to a custom table
- Is it possible to use WordPress as an online portfolio for text content? What kind of theme would I look for?
- Building a store locator with google maps
- How to make wp_enqueue_style and wp_enqueue_script work only on custom post type
- How to create user groups and allow custom posts and plugin modify/access to specific group?
- Correct way to make meta box with more than one meta field secure
- I want to extend the current themes’ single.php to display the meta fields of my CPT
- How can I create a custom shortcode that will return a custom post type by ID?
- more types plugin – display all post of post type on page
- When using Simple Fields plugin, how do I pull the information out of the database to display on a page?
- Allow HTML in Excerpts in Elementor
- ‘No Results Found’ on single post for custom post type
- Making a Template for a CPT created by a plugin
- auto populate list of questions if user select a category xyz
- “Custom Post Type Permalinks” plugin URL strcuture
- Unable to delete custom post types, confusion around capabilities
- What is the best way for showing a grid of customer logos?
- Custom Post Type Fields
- How to delete all trashed item in one-go
- How can I use a file in my plugin as a replacement for single.php on custom-post-type query?
- publish_post action doesn’t work
- custom post type don’t appear in the home page
- Edit Permalink Structure For Custom Post Type or Modify .htaccess?
- How to set category correctly for a custom post created by a remote API call?
- How to use template_include hook with form submission?
- How to select a paragraph other than the 1st to be the post’s excerpt?
- How do we update a custom file upload field with the Advanced Custom Field plugin?
- $pages = get_pages(‘child_of=’.$post->ID); Why arguments are concatenated?
- Price comparison table based on Custom Post Type?
- How can I list custom post type categories of portfolio
- Show related posts based of current ACF field name in a single page post (a loop within loop)
- Custom Template for wordpress cpt plugin
- “Allowed memory size” problem [closed]
- WordPress truncate posts question (plugin related)
- “After file loaded” action
- Custom Post Type template for homepage
- Filtered content appears in the excerpt
- How to create repeater field manually, without plugin (ACF Pro)?
- Rename existing cpt and taxonomy with new textdomain
- how to create hierachial taxonomy and manage under single post type?
- Best method of implementing compartmentalized custom post types on a multi-site network
- How to search post titles with whole words only, but not the exact word only?
- Remove custom taxonomy name from the slug – Custom Post Type UI
- Check if theme supports sidebar
- Custom Post Type same name as Category
- Can i stream data to a custom_post_type?
- Is there a hook similar to “save_post” which only fires AFTER the post is completely published?
- How to display the custom post related blog by category?
- Undefined index: custom_post_template_present
- save_post hook partly firing in update post
- WordPress hide post from custom post-type on a single page
- $wpdb->insert not working inside save_post tag
- Cannot view Custom Post Type no matter what I try
- Page not found after creating the add new post slider using custom post type
- Array to string conversion error when trying to POST multidimensional array
- WordPress custom posttype meta values doesnot save
- Assigning a custom post type to a custom page
- 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?
- 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
- Top Contributors Plugin with Custom Post Type
- How can i do custom author list?
- featured image problem with custom post type
- How can I default a new post to being saved?
- Is an Office a custom post type [closed]
- 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]
- Display Custom Post Type and Custom Taxonomy Data on Front End Using Only a Plugin
- Filter custom post type returned from REST api
- Links not opening as they should. Custom WP plugin
- How to make content as required in 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?
- How do I know if an archive correspond to a custom post type taxonomy?
- Load a custom post type template.html from a plugin
- How to make a page setting translatable in theme?