You can use conditionals:
<?php
add_action( 'wp_enqueue_scripts', 'wpse_enqueues' );
function wpse_enqueues() {
// Only enqueue on specified single CPTs
if( is_singular( array( 'anime', 'manga' ) ) ) {
wp_enqueue_style( 'wp-manga-plugin-css', WP_MANGA_URI . 'assets/css/style.css' );
}
}
?>
If you need the CSS on archives as well, that’s another condition:
if( is_singular( array( 'anime', 'manga' ) ) || is_post_type_archive( array( 'anime, 'manga' ) ) ) {
wp_enqueue_style( 'wp-manga-plugin-css', WP_MANGA_URI . 'assets/css/style.css'
}
Related Posts:
- How to laod wp_enqueue_style to another header i created my self
- Redesigning Custom Post Type “Add New” page
- how to include other plugins css files in a shortcode?
- How Do I Use The WordPress Plugin Posts 2 Posts by Scribu?
- Creating a default Custom Post Template that a Theme can override
- How to load different css file for different pages
- Jetpack plugin (ShareDaddy): Prevent share buttons showing on custom post types?
- Getting Custom Post Type content from main-site of a Multisite
- Custom database or Custom Post Types?
- Custom comment type maybe?
- Prevent page slug from interfering with custom post type archive permalink?
- Twillio How To Send SMS for Custom Post Type
- wp_enqueue_style in Plugin [duplicate]
- Seriously stuck with some custom meta box/plugin stuff
- Themes VS Plugins [duplicate]
- Enable comments for post with comments meta box removed
- How to Build a Movie Library in WordPress 3.x
- How do I get multiple pages by title?
- Prevent CSS/JS loading when plugin is not used
- I need to add a custom “cover” to every new post — plugin or custom setup?
- Plugin “Meta Box”: Implementing meta boxes in custom post type
- Plugin allowing for artists, events and venues
- Disable Other Plugins on my Custom Post Type?
- How to get images from EDD post?
- custom taxonomy and custom post type url conflict
- Allow users mark posts as “complete”?
- Is there a way to order posts and custom post types as one group?
- RW Meta Box ,Problem setting post title
- dynamically generating plugin syntax
- Duplicate posts when posting nulls in records in phpMyAdmin [closed]
- Exclude post by custom meta with pre_get_posts
- get_post_type() and WP_QUERY issue
- Making a plugin only available on the front-end for the logged in super admin
- List taxonomy terms for post as checkboxes
- How to remove plug in styles for WPForms Lite [closed]
- Custom post type – no layout section of Document tab, and no author choice
- Creating a custom post type, adding custom meta fields, preventing all future editability of posts of this type
- Keep a post copy when this one is updated – issue
- how to add a button next to the wordpress view button?
- Can’t catch enqueued style
- Adding CSS to custom post type admin page causes error
- ACF: post query, hide duplicate values [closed]
- Redirect to another page using contact form 7? [closed]
- WordPress custom taxonomy not showing
- Using ACF default value to autoincrement a number field
- Amazon.com intergration with WordPress?
- Sticky option for custom post types without using custom fields or plugins
- Adding custom meta boxes to specified custom post type
- How do I make reusable content blocks for header and footer when using WordPress headless with another front-end?
- plugin enqueue style on all pages
- Deregister scripts from plugin
- How can I store data from custom fields to custom tables?
- 2 wordpress site same database
- How to Include Custom Post Content From Plugin
- Custom post type change excerpt more and excerpt length
- Use jQuery Datepicker code from plugin
- What hook can I use to modify custom post data before it is displayed on the page?
- Order posts of a custom post type by the event date using FT Calendar Plugin
- Posts 2 Posts: Display custom types connected to the same other custom type but with another connection
- Creating teams of users in WordPress
- hardcoded wp pages/plugins problems
- How display specific category post to specific users?
- Load CSS before Theme CSS
- Need to edit author permissions | custom taxonomy
- Is it possible to pin a post in second position from top
- WordPress REST API: Query media files attached to a custom post type
- Save log for imports in WordPress database – options-table, custom post type or other place?
- How to get the custom field value using SQL query
- How to display emails as a post?
- Error in Fetching Custom Post Type parent Category URL (slug)
- Register PODS Custom Field with WPGraphQL [closed]
- Hidden permalink different from displayed permalink
- Adding custom post category to categories widget
- Custom Post Type with Sequence ID
- Add an action based on custom post meta field
- How to arrange custom posts in the backend/admin by custom taxonomy
- Adding LOAD MORE on a page
- how to convert frontpage.php to dynamic page?
- Creating custom “player-objects”
- Hide some portion on single.php base on author
- Displaying image from a repeatable group
- CPT-onomies CPT_TAXONOMY->get_terms extremely slow with 6K posts
- get recent 12 days post then random in wordpress
- What method should I use for a sidebar widget that reads latest posts?
- Making a Custom Post Type Publish Loop
- How to list the categories by custom taxonomy created?
- Is a custom post type considred a plugin?
- Make a magic tag work with Custom Post Types
- Looking for a plugins for organization portal (Staff, Units, Departments)? [closed]
- 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]
- Failed to update a post when I add a taxonomy to it
- 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 add CPT in Elementor pro search template
- how to compare date meta value in jet smart filter Date query?
- Tickera missing attendees – No attendees found
- PHP Fatal error: Cannot redeclare distance() when making a new block