You can define specific stylesheets for specific PHP files.
If you are using a Child Theme, use the functions.php of the Child.
You should use something like:
function my_custom_css() {
wp_register_style( 'stylesheet_name', get_stylesheet_directory_uri() . '/stylesheet.css' );
}
add_action( 'init', 'my_custom_css' );
function my_custom_css_enqueue() {
// only enqueue on product-services page slug
if ( is_page( 'my-page' ) ) {
wp_enqueue_style( 'stylesheet_name' );
}
}
add_action( 'wp_enqueue_scripts', 'my_custom_css_enqueue' );
Related Posts:
- My CSS, footer and header don’t show up!
- Want to make header and footer CMS driven sothat Editors can modify its content from wordpress admin section
- Creating dynamic header and footer files
- Insert stylesheet into WordPress header?
- Export Header and Footer
- Custom headers in WordPress, are there also custom footers?
- Code needs wrapper/container to put footer back in, but where?
- Add my footer menu to the header
- How to reuse parts of WordPress site e.g. header, footer, part of header for multiple WordPress sites?
- CSS to make HTML page footer stay at bottom of the page with a minimum height, but not overlap the page
- force footer on bottom on pages with little content
- How can I make my footer center to the bottom of the page?
- Why won’t wp_mail() let me set the From: header when plain old PHP mail() will?
- How does one suppress a 404 status code in a WordPress page?
- Is it safe to fix Access-Control-Allow-Origin (CORS origin) errors with a php header directive?
- Putting content into header.php without using wp_head
- How do you completely remove the default header and footer using functions.php?
- Image slider to display at the very top of home page
- Remove rel=shortlink from HTTP header
- How do you log a user out with wp_logout?
- Different custom header image on different page
- HTTP Header on specific page is application instead of text
- Strip HTML comments from plugins in header/footer
- Auto-refresh page every minute?
- Remove sticky behavior from top navigation on twenty fourteen theme?
- Remove link around logo
- How do the default themes reference style.css?
- why enqueued styles in header.php shows in footer?
- WordPress Admin Bar Covering & Overlapping Fixed Menu Header [closed]
- How to find out if page_for_posts is showing (in order to style menu item)
- Google Tag Manger – no-script Code Not Found
- Resizing of a header/div in a website through css in wordpress [closed]
- Determine what pages are in my header [closed]
- How to remove main domain header title from after sub domain header title
- I want to hide header in the static homepage that I am working on [closed]
- 404 or ugly page on IE, but Firefox, Chrome looks perfect
- How to change header dimensions in WordPress?
- Changing header text from uppercase to normal [closed]
- Safe to start a php session on get_header action?
- Return get_header and get_footer string instead of echo it
- How to change footer or for different kinds of users in wordpress?
- H1 tags for header image?
- How to remove footer from just homepage
- Is there a way to get minimal WordPress functions for iframed content?
- Clickable image link sends people to wrong URL
- custom header navigation has odd spacing [closed]
- Why does WP load so many files in the head of source code? How do I optimize it?
- Trying to set a cookie based on $_POST parameter
- How to Customize Wp Default Title and a prefix
- Hook to change HTTP response headers
- Responsive issue with secondary logo – not sticking in position [closed]
- Empty header tags [closed]
- Insert Facebook button into header [closed]
- Where are the contents of WP_Head
- How can I selectively insert a header for my shop page in woocommerce? [closed]
- Changing footer depending on URL (poli language site)
- How do I begin debugging where the description meta tag is set for my categories?
- header, stylesheet not being read
- How do I get the Social Media Plugin to show up in my Twenty Eleven child theme’s header?
- How to add script right after ?
- Adding more tabs to horizontal navigation bar
- Dynamic height in custom header image panel
- Hook for plugin to insert into entry-meta
- Im having trouble centering menu items in footer due to “flexbox”
- How do I modify the tag on my Category Archive page?
- Remove a link in the header
- Update Code to be Compatible with WP 5.3 (‘cannot modify header information’ warning)
- Using Javascript On Page – Header and Footer Now Missing
- set cookies on certain page only
- Twenty seventeen header is not responsive
- 3 WP installations on the same domain, with the same header
- Need help removing block of white space between footer widgets and footer [closed]
- How to make custom_header_setup() image as background image?
- WordPress site screwed up after adding Facebook Pixel inbetween header tags
- WordPress cookie issue on login: “ERROR: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.”
- Enable CORS for getting an inline SVG by URL
- Insert Code into Header Only on Blog Posts
- How to include different html tags in the header for different pages?
- In the Header.php file, is there a way to swap between one layout and another?
- expires header in w3 total cache
- Header and footer fail to load with SSL and custom links
- Set cookie so user sees alert banner/popup only once
- How to set x-priority header = null while using plugin WP e-commerce?
- Best use adding user generated JS/CSS to a theme with a plugin
- WordPress Get Header and Footer using in Admin Area
- Reduce Page loading time
- Removing old code from header
- Change header based on visitor choice
- How to remove uncategorised posts from WordPress
- Custom header shows two or three or more images
- Converting Menu Links to List Elements
- making posts linked outside of WordPress still use the same header and footer
- Custom Header won’t Repeat
- Loading second header.php for other homepage showing double header.
- Editing Header with a Page Builder [closed]
- site-description css is overriden [closed]
- WordPress mobile and desktop header problems [closed]
- WooCommerce: I Need to hide my page title/header (including menu) from all the WooCommerce related product pages, such as category and keyword pages
- Footer option is missing in Customiser
- wp_redirect problem using code snippets