Last active
August 29, 2015 14:08
-
-
Save danielpataki/9754ee800680d19c6717 to your computer and use it in GitHub Desktop.
Grid Shortcode
This file contains 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
function my_code_output( $atts, $content ) { | |
return '<pre><code>' . $content . '</code></pre>'; | |
} | |
add_shortcode('code', 'my_code_output'); |
This file contains 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
[code type='javascript'] | |
var array = [ 'Thud', 'Night Watch', 'Jingo' ]; | |
[/code] |
This file contains 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
<pre><code>var array = [ 'Thud', 'Night Watch', 'Jingo' ];</code></pre> |
This file contains 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
[code] | |
$array = ( 'Thud', 'Night Watch', 'Jingo' ); | |
[/code] |
This file contains 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
<pre><code>$array = ( 'Thud', 'Night Watch', 'Jingo' );</code></pre> |
This file contains 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
[row] | |
[column medium="6" large="3"] | |
Column 1 [/column][column medium="6" large="3"] | |
Column 2 [/column][column medium="6" large="3"] | |
Column 3 [/column][column medium="6" large="3"] | |
Column 4 [/column] | |
[/row] |
This file contains 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
function my_column( $atts, $content ) { | |
$atts = shortcode_atts( array( | |
'small' => 12, | |
'medium' => null, | |
'large' => null | |
), $atts ); | |
$atts['medium'] = ( $atts['medium'] == null ) ? $atts['small'] : $atts['medium']; | |
$atts['large'] = ( $atts['large'] == null ) ? $atts['medium'] : $atts['large']; | |
extract( $atts ); | |
$sizes = 'small-' . $small . ' medium-' . $medium . ' large-' . $large; | |
return '<div class="columns ' . $sizes . '">' . do_shortcode( $content ) . '</div>'; | |
} | |
add_shortcode( 'column', 'my_column'); |
This file contains 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
function grid_styles() { | |
wp_register_style( 'grid', get_template_directory_uri() . '/css/grid.css', array(), null ); | |
} | |
add_action( 'wp_enqueue_scripts', 'grid_styles' ); | |
function my_row( $atts, $content ) { | |
wp_enqueue_style( 'grid' ); | |
$content = preg_replace( "/\[\/column\](\<br \/\>|\<\/p\>.?\<p\>).?\[column/s", '[/column][column', $content ); | |
return '<div class="row">' . do_shortcode( $content ) . '</div>'; | |
} | |
add_shortcode( 'row', 'my_row' ); |
This file contains 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
function grid_styles() { | |
wp_enqueue_style( 'grid', get_template_directory_uri() . '/css/grid.css', array(), null ); | |
} | |
add_action( 'wp_enqueue_scripts', 'grid_styles' ); |
This file contains 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
<div class='row'> | |
<div class='small-12 medium-6 large-3 columns'> Column 1 </div> | |
<div class='small-12 medium-6 large-3 columns'> Column 2 </div> | |
<div class='small-12 medium-6 large-3 columns'> Column 3 </div> | |
<div class='small-12 medium-6 large-3 columns'> Column 4 </div> | |
</div> |
This file contains 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
[row] | |
[column medium="6" large="3"] Column 1 [/column] | |
[column medium="6" large="3"] Column 2 [/column] | |
[column medium="6" large="3"] Column 3 [/column] | |
[column medium="6" large="3"] Column 4 [/column] | |
[/row] |
This file contains 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
function my_row( $atts, $content ) { | |
$content = preg_replace( "/\[\/column\](\<br \/\>|\<\/p\>.?\<p\>).?\[column/s", '[/column][column', $content ); | |
return '<div class="row">' . do_shortcode( $content ) . '</div>'; | |
} | |
add_shortcode( 'row', 'my_row' ); |
This file contains 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
function my_row( $atts, $content ) { | |
return '<div class="row">' . do_shortcode( $content ) . '</div>'; | |
} | |
add_shortcode( 'row', 'my_row' ); |
This file contains 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
function my_code_output( $atts, $content ) { | |
$atts = shortcode_atts( array( | |
'type' => 'php', | |
), $atts ); | |
return '<pre class="language-' . $atts['type'] . '"><code>' . $content . '</code></pre>'; | |
} | |
add_shortcode('code', 'my_code_output'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment