add to functions.php
function wpc_body_class_section($classes) {
if (is_user_logged_in()) {
$classes[] = 'CUSTOMPOST-'.count_user_posts(get_current_user_id());
}
return $classes;
}
add_filter('body_class','wpc_body_class_section');
Related Posts:
- post body class for current user only if they are the post author
- Custom Taxonomies in body class with parent slug
- Get list of registered custom post types
- How to hide CPT files from media library programmatically
- post count is wrong when using same taxonomy for 2 different CPT
- Issues when rewrite rules collide?
- Determine which template-{slug}.php is being loaded
- How to remove/hide elements from the admin menu?
- Show Custom Post Type by Author
- Newer/Older posts links display same posts on every page
- How to sort CPT by custom meta value (date), and return posts month by month
- Archive page for taxonomy of custom post type
- Search results ordered by custom post types are not grouped
- $wpdb returns no results with SELECT query on custom post type, works on default post type
- When viewing single parent post, display list of children
- Featured image metabox not showing up
- Limit Authors to their Own Posts on front-end excluding admins
- Exclude current post when getting related post on custom post type and taxonomy
- How to redirect all pages of a custom post type [duplicate]
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- Add information above a custom post type listing of all posts page
- custom post type default permalink
- Show custom field from custom taxanomy term on custom post type
- How do I sort a custom post type admin column using two meta keys?
- Making a Custom Post type only visible to non-users via a specific link
- Allow Administrator role access to custom capabilities [duplicate]
- Search doesn’t find tags or categories in custom post types
- Add custom post type archives to search results?
- Taxonomy.php Not Showing Posts
- Custom search results page query, link permalink to post title while separating by post types
- Plugin translation not working apart from name and description
- custom comments on specific post type
- Archive template for custom post type only lists first 10
- Taxonomy Archive: Display only one post per term from separate custom taxonomy
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- single-{cpt}.php ignored
- Crafting WP_Query array, sort by date
- Disable block with taxonomies at post page
- WordPress wrapped added a span tag to every single p tag
- Custom Post Types with a common category for a blog listing
- Custom Widget WP_Query problem
- Custom Fields for Custom Post [closed]
- Terms showing up in object cache on unrelated pages
- Show Custom Post Type meta boxes only on Page Edit
- Creating a Page Template to display all items from a Custom Post Type
- 2 Different Custom Post Types in Submenu
- How to assign classes to all elements?
- Search filter triggered & sort by custom post type
- Select event where start date is smaller than current date and end date is greater than current date
- How can meta boxes be added to “unknown” custom posts?
- Custom “radio button meta box” not saving correctly
- link to a random custom post while excluding current post
- Custon Content within WordPress Loop
- Custom Taxonomy Category link
- HowTo: Custom Post Type (Meta) to Custom Table
- Create Array from custom post type to display a slider
- Fix permission error for deleting custom post from front-end?
- Archiving custom post content?
- How can I remove filters from custom post types?
- Custom post type slug 404
- Counts Posts ( custom post type ) by Author in author.php
- WordPress multisite – is it possible to have different taxonomies for each site?
- WP_Query order by two values
- copy images from custom field to another custom field
- How to use a specific custom field in a custom post type as slug
- Wp custom post custom capability not working together
- Meta box not appearing in my custom post type
- Display Taxonomy Term Children in a Drop Down without Submit Button
- Custom taxonomy query showing more than 4 posts
- Loading multiple post content in FancyBox
- Display CPT index page as front/home page
- How add column from new table in Custom Post Listing (admin)
- Home page is getting current-menu-item even if it’s not home
- jQuery UI & Admin (Calendar)
- no_rest_route in Unit Testing for REST endpoint for CPT registered via show_in_rest
- how to achieve this permalink abc.com/CPTName/CustomPostTypeCategorySlug/categoryname
- CPT loop doesn’t seem to account for post date?
- A certain theme is forcing it’s singular post layout
- have to do a while have post to show for two custom post types sharing the same taxonomy?
- How to change URL for custom post type archive?
- How to handle this wordpress custom post type rewrite problem?
- using search filter ajax for custom field type post
- Is it possible to arrange Custom Post Types from CPTUI into a Folder?
- relationship between custom post type?
- Attempting to get number of grandchildren of page in WP_Query loop
- How to use a custom post type as child of a particular post of another CPT?
- Automatically Add a default category to a Custom Post Type before save_post action
- Custom post Query and WordPress Post Query Clash
- Custom post types with child taxonomy not visible in admin
- How to make a shortcode for my WP_Query Loop? [duplicate]
- Filter By Term Not Working – Custom Post Type
- Custom post type permalink issue [duplicate]
- Static front page has page url not site url
- Post is not being published after clicking on Publish button in Custom Post Type
- Custom Post Type with /%shop_name%/gallery/%gallery% permastruct?
- How to create content automatically when a post is published?
- Updating User Meta from Custom Post Field Upon Publish Not Working
- Pagination not working with custom loop
- Catergory args causing loop not to show
- How to Create Short Code Using Custom Post type