Last active
October 19, 2016 21:52
-
-
Save vovafeldman/5fd72dc97a87ae4da3be615619dab055 to your computer and use it in GitHub Desktop.
Freemius - Callouts Shortcodes
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
.wedocs-single-wrap | |
{ | |
.wedocs-single-content | |
{ | |
article | |
{ | |
.entry-content | |
{ | |
blockquote | |
{ | |
$alpha: 0.02; | |
border-left-color: #777; | |
background: rgba(#777, $alpha); | |
padding: 0.5rem 0.5rem 0.5rem 1.5rem; | |
font-style: italic; | |
&.note | |
{ | |
border-left-color: $fs-logo-blue-color; | |
background: rgba($fs-logo-blue-color, $alpha); | |
font-style: normal; | |
} | |
&.warning | |
{ | |
border-left-color: $fs-logo-orange-color; | |
background: rgba($fs-logo-orange-color, $alpha); | |
font-style: normal; | |
} | |
&.tip | |
{ | |
border-left-color: $fs-logo-green-color; | |
background: rgba($fs-logo-green-color, $alpha); | |
font-style: normal; | |
} | |
} | |
} | |
} | |
} | |
} |
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 | |
/** | |
* @author Vova Feldman | |
* | |
* @param array $atts | |
* @param string $quote | |
* @param string $shortcode | |
* | |
* @return string | |
*/ | |
function freemius_callout_shortcode( $atts, $quote = '', $shortcode = 'fs_note' ) { | |
$html = WPCom_Markdown::get_instance()->transform( $quote ); | |
// Remove 'fs_suffix'. | |
$class = substr( $shortcode, 3 ); | |
return "<blockquote class=\"{$class}\"><p>{$html}</p></blockquote>"; | |
} | |
/** | |
* Add markdown special shortcodes. | |
* | |
* @author Vova Feldman | |
*/ | |
function freemius_add_callout_shortcodes() { | |
add_shortcode( 'fs_note', 'freemius_callout_shortcode' ); | |
add_shortcode( 'fs_warning', 'freemius_callout_shortcode' ); | |
add_shortcode( 'fs_tip', 'freemius_callout_shortcode' ); | |
} | |
add_action( 'init', 'freemius_add_callout_shortcodes' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment