Last active
October 27, 2016 04:09
-
-
Save mathetos/68add4ff52df1b913816b40907d2fce1 to your computer and use it in GitHub Desktop.
Super basic shortcode with stylesheet enqueued globally
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 | |
/* | |
* Example Shortcode and Globally Enqueued Stylesheet | |
* | |
*/ | |
// Our Shortcode function | |
function hiroy_shortcode( $content = null ) { | |
// do something to $content | |
$content = '<h2>Hi Roy!</h2>'; | |
// always return | |
return $content; | |
} | |
// Our Shortcode Action | |
add_shortcode( 'hiroy', 'hiroy_shortcode' ); | |
// Enqueue the Stylesheet Globally | |
function hiroy_enqueue_scripts() { | |
wp_enqueue_style( 'hiroy-css', 'hiroy.css', 'parent-stylesheet', '1.0', all ); | |
} | |
// Enqueue Stylesheet Action | |
add_action( 'wp_enqueue_scripts', 'hiroy_enqueue_scripts' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment