Last active
February 8, 2021 07:38
-
-
Save dkvadratu/5a16f281951a14c033318bfe66a47664 to your computer and use it in GitHub Desktop.
{WP} shortcodes [bartag foo="foo-value"]
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 bartag_func( $atts ) { | |
$a = shortcode_atts( array( | |
'foo' => 'something', | |
'bar' => 'something else', | |
), $atts ); | |
return "foo = {$a['foo']}"; | |
} | |
add_shortcode( 'bartag', 'bartag_func' ); | |
//usage: [bartag foo="foo-value"] |
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 blocks( $atts, $content = null ) { | |
extract(shortcode_atts(array( | |
'border_radius' => 'no', | |
'spacing' => 'no' | |
), $atts)); | |
return '<div class="ef-blocks d-flex flex-column flex-md-row spacing-'.strtolower($spacing).' border-radius-'.strtolower($border_radius).'">'.$content.'</div>'; | |
} | |
add_shortcode('blocks', 'blocks'); | |
//usage: [blocks border_radius='yes']Inner content to print[/blocks] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment