the if(is_front_page())
will check if front page is being viewed, then load your css and meta slider .
Codex documention
<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
# added
if(is_front_page())
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
add_action( 'init', 'child_theme_init' );
function child_theme_init() {
# added
if(is_front_page())
add_action( 'storefront_before_content', 'woa_add_full_slider', 5);
}
function woa_add_full_slider() {
# added
if(is_front_page()){
?>
<div id="slider">
<?php echo do_shortcode("[metaslider id=252 percentwidth=100]"); ?>
</div>
<?php
}
}
?>
Related Posts:
- Remove “Category:”, “Tag:”, “Author:” from the_archive_title
- get_template_directory_uri pointing to parent theme not child theme
- Get the ID of the page a menu item links to?
- Add container to nav_menu sub menu
- 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?
- Paged Single Post doesn’t redirect to the main url after Removing Pagination
- 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
- How to add a rel attribute to images that contains their categories?
- Is it possible to be more page/post specific with admin_enqueue_script?
- radio button is checked but display not check
- Theme options WP Editor
- Enqueue styles after a plugin
- Properly applying nonce to a form using AJAX
- What is the $context in remove_meta_box function?
- Add external js file to footer with id
- Conditions for Users and Visitors
- add_filter priority problem
- wp_enqueue JavaScript in child-theme (ReferenceError) using Search & Go
- How can I enable uploading excel files?
- Super simple shortcode not working
- Using “Read More” link with custom excerpt
- Enqueue scripts not working with if is page conditional tag in functions.php
- what function can I use to automatically output og tags per page/post?
- Why does the ‘wp_nav_menu’ function work only until a menu is created?
- Add error message on password protected page ONLY when password introduced was incorrect
- Twentyten Child Theme: header images display messed up in admin panel
- Get Current Post ID in functions php, meta query filter
- Where to start learning more about wordpress templates [closed]
- What did I do wrong in my functions code, that will not change the “Get New Password” text to “Send It”?
- Jquery implementation not working on page reload
- Parse error after modifying the template menu [closed]
- Reuse variable in hook callback
- PHP mixed with some JS code to update WordPress theme settings
- What does this code do? (Injected code hacked)
- Pass parameter to hooked function using custom page template
- Is my code correct to enqueue CSS on a specific page?
- Where to put random functions?
- Define PHP variable from a seperate API if statement
- WordPress function only executes once
- Dequeue Script Using Functions.php
- Auto-Tweet if Type is ‘Status’ using OAuth
- Infinite counting in WordPress
- Using $WPDB to create simple array to check against user entered value
- Create custom function for hero image
- How to add custom li item to wordpress menu
- error at login page in wordpress
- More tag locked in Hemingway
- Specify multiple categories for custom post template – FATAL ERROR
- Suggest Users basing on User taxonomy
- Code to insert code into single php
- How to display 2 function calls in same line?
- Remove a Plugin function through theme’s function.php?
- Custom function for search form
- If is_single in functions.php
- How to conditionally add a widget via a hook in functions.php
- Unescape attribute the_title() on CDATA in RSS feed
- Custom Menu in Admin doesn’t change menu in browser
- How can I show different content for different user-levels?
- WordPress function bloginfo not echoing output on parts of the pages
- get_image_tag() html output : empty src attribute
- How to change a meta value (of a published post) after X days.?
- How to change text color depending on the number value (Using javascript)
- Warning at top of website & top menu gone
- How to display an image before title text in menu items
- How to add custom metakey to shop_order page’s searching function?
- Redirect User Role When on Specific Page
- How to force one script to load before google tag manager script
- Show ‘Add to Cart’ on Out of Stock products
- wp_get_current_user return ID = 0 when used outside of wordpress, such as webhook / fulfillment dialogflow
- I can’t in any way include css in my theme using functions.php
- Pass post ID from archive template to functions file
- Competing Login Redirects – Need to be Combined?
- How to add styles in existing function?
- admin-ajax.php 403 forbidden only when calling from external file
- Problem with add_rewrite_tag
- getExcerpt: Make ellipsis appear only if character limit is reached
- Dynamic Title for custom post types
- How do I change the URL returned by next_posts_link()?
- WordPress SEO By Yoast Plugin is interfering with a custom function code – how to troubleshoot and fix it?
- shortcode inside post called by ID does not render as expected
- Woocommerce – Checkout error message
- Adding and updating repeating custom field meta data
- User’s Comments Number: Storing it in a meta field for different uses
- Show one post per author and order by custom field
- Text before price on WooCom
- Warning: call_user_func_array() expects parameter 1 to be a valid callback
- Change Post status based on custom field date +1 day
- How to add height and width dimensions automatically to archive descriptions
- How to store page-{id}.php templates in custom folder