Last active
January 8, 2018 21:41
-
-
Save itsdavidmorgan/6127faa4a3e44c987fe73f978a65de91 to your computer and use it in GitHub Desktop.
Enqueue Front-End Styles For Custom Block
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function organic_profile_block_block_assets() { | |
// Styles. | |
wp_enqueue_style( | |
'organic-profile-block-frontend', // Handle. | |
plugins_url( 'style.css', __FILE__ ), // Block frontend CSS. | |
array( 'wp-blocks' ), // Dependency to include the CSS after it. | |
filemtime( plugin_dir_path( __FILE__ ) . 'style.css' ) // filemtime — Gets file modification time. | |
); | |
wp_enqueue_style( | |
'organic-profile-block-fontawesome', // Handle. | |
plugins_url( 'font-awesome.css', __FILE__ ) // Font Awesome for social media icons. | |
); | |
} // End function organic_profile_block_block_assets(). | |
// Hook: Frontend assets. | |
add_action( 'enqueue_block_assets', 'organic_profile_block_block_assets' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment