Skip to content

Instantly share code, notes, and snippets.

@itsdavidmorgan
Last active January 8, 2018 21:41
Show Gist options
  • Save itsdavidmorgan/6127faa4a3e44c987fe73f978a65de91 to your computer and use it in GitHub Desktop.
Save itsdavidmorgan/6127faa4a3e44c987fe73f978a65de91 to your computer and use it in GitHub Desktop.
Enqueue Front-End Styles For Custom Block
<?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