When using hooks such as wp_enqueue_scripts you have access to Conditional Tags. This allows you to only enqueue certain things on certain pages, templates, taxonomies, etc.
By default, WordPress accepts two template files as the natural blog:
index.phphome.php
You can read more about this in the Template Hierarchy post, while it does say “Home” this will only take the place of the homepage if front-page.php does not exist in your theme. What you have is a Page Template as your “Blog” and not the standard you need to use is_page():
/**
* Enqueue Styles and Scripts
*/
function theme_name_scripts() {
if( is_page( 'blog' ) ) { // Only add this style onto the Blog page.
wp_enqueue_style( 'style-name', get_stylesheet_uri() );
}
}
add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
Related Posts:
- I put my blog on a subpage, how do I get page title?
- index.php template is used instead of blog page
- Page editor missing Templates drop down
- How to edit contents of dynamic_sidebar()?
- How to hide/redirect the author page
- Need to give custom page template for each language in WPML
- Templates & CSS – Proper Programming Practice?
- Create Page that uses specific template
- Post formats template
- Hide Front-End Admin Bar Including 32 px Spacing
- What is a good way to present templated content in WordPress?
- Adding variable to get_template_part
- How to apply a custom template for posts by default?
- How to move style from template file to section?
- Subpage template
- How to create a wordpress template without using any page
- Advanced Custom Fields – display when specific template used?
- How do I find the directory of a page template?
- Missing ‘Page Attributes’
- how to use custom page template in a page?
- the_excerpt producing empty output
- Conditionally display different images before the content in a page template
- Is there a way to set different post templates for parent posts and child posts in the same post type?
- Change wp-signup.php Page Template
- How to remove the Template drop down, but keep Parent and Order
- Templates have disappeared from drop down lists
- One of my pages uses the archive.php template only. Why?
- Getting pages filtered by template assigned
- Get link to a specific template file [closed]
- Default Template Selected After Changes in Elementor [closed]
- Use same page template for parent and child pages in a theme
- displaying category and subject posts
- How to duplicate a page template but make minor changes to the header?
- Adding Query to Custom Page Template
- get_file_data to read data for Custom Template File?
- Page attributes missing
- Where is Number of Posts Set?
- Page template option missing
- How do I get the page template name chosen?
- How can I add text to a specific ‘Edit Page’?
- Unable to add template to page set as Posts page in WP V 4.6.1
- get_header(), get_footer() from plugin template
- What template is used for viewing Media Library Files?
- Page template for a site from network
- Differnt page template for page 2 of blog feed
- Force WordPress to NOT display the manual excerpt
- Undefined get_header function
- Single-page.php template file name not shown
- How to display custom post type?
- Hard Coding Components on a Client Specific Websites
- Will placing custom templates in sub directory break any native WordPress functionality
- Organize template parts and page templates in folders in regards of template hierarchy
- Blog page won’t show Blog template
- templates with page teasers Or Featured Items
- Random home page at each refresh between array of page IDs
- Search button click sends to single-custom_post_type instead staying at the same page
- How to configure my blog page
- Display a custom 404 page without a redirect
- How can I make custom page templates work on child theme?
- Change Page Template Based on URL Rewrite in WordPress
- WordPress blog posts template bug [closed]
- Nested Page Template not showing in page attributes
- Creating custom post-listing templates in twentyseventeen child theme
- When to use content-pagename.php?
- Submit form to another template (ugly url)
- Page Templates Used in Custom Post Type
- custom template – override plugin template in child theme – issue with scripts
- List all pages using a specific template on a page
- Is this the best way to complete disable category archive pages?
- Add pagination to blog
- Is there a way to share a template/markup with the JSON API so that it doesn’t need to be declared both in PHP and in JS?
- How to install a wordpress website template on an existing website?
- Custom Archive with Content for Custom Post Type
- Blog template PHP [closed]
- Page.php vs Single.php
- Read more button not working
- why does blog page ignore template [closed]
- My homepage’s width has reduced and I can´t fix it [closed]
- html blog template to wordpress template
- How to duplicate a template in wordpress site editor?
- How do I get the size of an attachment file?
- How to get IDs for objects in menu branch?
- Restrict a search to a custom post type
- Single page theme
- Custom Page Template for “Older Posts” Pages
- Is it possible to set a page template on a dynamic home page (articles list)?
- Turning on the 404 page on localhost
- Checking for page templates in child theme
- Stylesheet comment header: Which header names are mandatory? [duplicate]
- How to add posts list to a page template?
- Problem when linking out to separate file within foreach loop
- Can I add a default Block to my custom theme?
- Remove post templates from the selection box menu when creating a single post
- How can I force URL of a custom post type archive to use a page template?
- Possible to have one template call different sidebars for different pages?
- how can I add a “read more” tag directly in the template?
- How to display specific child page template in wordpress
- the_post() in RSS feed
- How can I modify this code to include the parent?
- Problem with custom page template and permalink