Your problem is that you have wrapped your complete function and your action inside your conditional check. Your conditional check for your page template should be in your function.
Page templates gets set quite late, too late for your action.
Your function should look like this
function flatsome_scripts()
{
if( is_page_template( 'template-flat.php' ) ) {
wp_enqueue_style( 'flatsome-style', get_template_directory_uri() .'/flatash/css/foundation.css', array(), '2.1', 'all');
}
}
add_action( 'wp_enqueue_scripts', 'flatsome_scripts' );
Related Posts:
- Remove “Category:”, “Tag:”, “Author:” from the_archive_title
- get_template_directory_uri pointing to parent theme not child theme
- Link to user’s profile settings page?
- One Child Functions.php for Multiple Child Themes
- Shared functions.php across multiple WordPress websites
- How to restrict actions and filters “properly” by conditions
- Extending auth_cookie_expiration based on user role
- Disabling pingback and trackback notifications
- AJAX handler throws 400 (Bad request) – why?
- How to get comments with mixed status using get_comments?
- How to display the_post_thumbnail if a post has one or otherwise display the first image in a post?
- Return only top-level navigation items from a menu using wp_get_nav_menu_items
- How to add .htaccess code through a function?
- Conditional tag is_page with a custom post type
- Add inline css to theme
- Too few arguments sent to custom function
- Issue adding text after short description on product pages Woocommerce [closed]
- Custom function for user register in wp?
- Child theme functions.php not executing
- How to add background image control to page admin controls?
- Call function without having to wait on response
- Retrieve post modified date for specific post by post ID
- add a function to submit options.php
- WordPress doesn’t Load JQuery Now? Do I need to enqueue JQuery also?
- Is it better to assign functions like get_the_id() to a variable if it’s used multiple times?
- is_user_logged_in not working to redirect only logged out users
- How to select a page within admin?
- wp_is_mobile dequeue not working
- Enqueue Style Only On Certain Pages Not Working
- Loading CDN that requires jQuery in WordPress
- Previous_post and Next_post – Custom Post Type
- Creating a child theme – functions.php code issue
- Only let plugin add actions to wp_head & wp_footer on single posts
- Setting Up Scheduled Tasks (For Scripts to Run)
- problem with has_post_thumpnail in foreach loop
- IF Statement on Button to make it complete and “uncomplete” based on user action / click
- Gravity Forms Button Text
- Find resources dynamically loading and change or add to the url
- Using shortcode content with nested shortcode
- When sale price is 0.00 show only regular price
- Function wont fire after custom post type is updated
- Removing custom meta data
- Conditional Gravity Forms filter in WordPress Multisite
- When a user logs in, how can they view the website instead of the admin menu?
- WordPress Page Restrict
- Do we have to use ftp to recover from a bad functions.php edit?
- current_time(‘timestamp’) seems to be different from the real current time
- Need help getting a function to function
- Load Post into DIV with Ajax
- How to get_template_directory() properly on local environment
- the_posts_pagination() function returns missing page numbering on some blog pages
- content editor format style tags
- Custom Behavior when Adding New Custom Post Type in Dashboard
- Missing argument for the function
- Does size of a theme’s functions.php file matter?
- How to add custom user avatar in wordpress
- custom functions in function file delete automatically daily
- Enable right click on WordPress site
- Init action and refresh page after form action
- Replace plugin function with a custom function?
- Delay a function, any function!
- Combine two active_callbacks into one on theme customizer
- How to create shortcode with html and php content?
- How to overwrite template.php file
- Fill empty custom field with other custom field
- Creating a custom wordpress widget and stopping js from running twice(once in active widget once in widget selector)?
- How do I find the code executed when wp_head() is called?
- Editor cannot access Theme Options
- How to assign php file(template) to several pages with same prefix page name/slug
- Is this a backup door?
- Include widget file in functions.php of child theme
- Need help making a short code work
- Is there a function for setting a password to a post?
- WordPress functions.php conditional include another functions file
- reWrite wp-content url to point on my cdn
- Last updated posts shortcode in functions.php
- How to reference different css (bootstrap) stylesheets for the header and body of a page?
- sort title descending with title with number
- Add #primary at the end of navlink permalinks on single posts
- Get post_author email for Zapier Integration
- Author social media aren’t shown on the page
- Is there anyway to force is_singular() to be true when not loading template?
- If click on Save/Publish change Post Status to Pending Review instead Publish
- Postback redirect through add_action is not triggered
- HowTo: Add wrapper to columns shortcode?
- uninstall a theme programmaticlly
- Could you please correct the code is_admin()
- get_comments not working properly after WordPress v4.4 update
- Retrieve a custom form field modified by a filter
- What add_action reference should I be using or should I use do_action?
- Allow the access over wp-login.php
- Create input select image URL?
- Including one page with WordPress functions into another
- Dynamically Generating User Meta Field
- Check if there is an post to be published in future
- Unhook the comment form in Buddypress
- Code in functions.php appearing on front-end and dashboard [closed]
- is_preview() always return false
- “woocommerce_output_related_products” not working
- sort by date in users