Permalink
Browse files

Added Tables Shortcakes

  • Loading branch information...
djm56 committed May 3, 2015
1 parent 94fad21 commit 982cd7aa4873b3012557b73bc2d76651457d843c
View
@@ -5,6 +5,31 @@ Pure.css Press Short Codes
Version: 1
## How to use
There are new buttons on the content of post and pages.
* G Button: Add a Grid - [pure-g]Content[/pure-g]
* U Button: Add a Unit - [pure-u standard="1" small="" medium="" large="" xlarge="" class=""]Content[/pure-u]
* standard is equal to pure-u-"number"
* small is equal to pure-u-sm-"number"
* medium is equal to pure-u-md-"number"
* large is equal to pure-u-lg-"number"
* xlarge is equal to pure-u-xl-"number"
* class is for any additional classes you want to add, multiple classes can be added.
* B Button: Add a button - [button href="http://www.theurl.com" class="pure-button-primary"]the button text[/button]
* T Button: Add a table -
*[table class=""]
*[thead]
*[theadcol]Header 1[/theadcol] [theadcol]Header 2[/theadcol] [theadcol]Header 3[/theadcol]
*[/thead]
*[tbody]
*[tbodyrow] [tbodycol]Content1[/tbodycol] [tbodycol]Content2[/tbodycol] [tbodycol]Content3[/tbodycol] [/tbodyrow]
*[/tbody]
*[/table]
* Each row of the table requires a new [tbodyrow]Content[/tbodyrow]
## Author:
Donovan Maidens ( [@Anomalous_Bot](http://twitter.com/Anomalous_Bot) / [anomalous.co.za](http://anomalous.co.za) )
@@ -24,5 +49,5 @@ Monstrosity short codes (Bootstrap) [Monstrosity short codes](https://github.com
## Acknowledgement
Yahoo [Pure.css](https://github.com/yahoo/pure/)
View
Binary file not shown.
View
Binary file not shown.
View
@@ -26,7 +26,36 @@
}
});
ed.addButton('table', {
title : 'Add a table',
image : url+'/table.png',
onclick : function() {
ed.selection.setContent('[table class=""]<br>\n\
[thead]<br>\n\
[theadcol]Header 1[/theadcol]\n\
[theadcol]Header 2[/theadcol]\n\
[theadcol]Header 3[/theadcol]<br>\n\
[/thead]<br>\n\
[tbody]<br>\n\
[tbodyrow]\n\
[tbodycol]Content1[/tbodycol]\n\
[tbodycol]Content2[/tbodycol]\n\
[tbodycol]Content3[/tbodycol]\n\
[/tbodyrow]<br>\n\
[/tbody]<br>\n\
[/table]');
}
});
ed.addButton('thead', {
title : 'Add a table head',
image : url+'/table.png',
onclick : function() {
ed.selection.setContent('[thead class=""]' + ed.selection.getContent() + '[/thead]');
}
});
},
createControl : function(n, cm) {
View
Binary file not shown.
View
Binary file not shown.
View
@@ -93,6 +93,119 @@ function pure_button_shortcode( $atts , $content = null ) {
}
add_shortcode( 'button', 'pure_button_shortcode' );
function pure_table_shortcode( $atts , $content = null ) {
extract( shortcode_atts(
array(
'class' => '',
), $atts )
);
$classtest = "";
if($class != "") {
$classtest = ' ' . $class;
};
// Code
return '<table class="pure-table ' . $classtest . '">' . do_shortcode($content) . '</table>';
}
add_shortcode( 'table', 'pure_table_shortcode' );
function pure_table_head_shortcode( $atts , $content = null ) {
extract( shortcode_atts(
array(
'class' => '',
), $atts )
);
$classtest = "";
if($class != "") {
$classtest = ' ' . $class;
};
// Code
return '<thead class="' . $classtest . '"><tr>' . do_shortcode($content) . '</tr></thead>';
}
add_shortcode( 'thead', 'pure_table_head_shortcode' );
function pure_table_head_column_shortcode( $atts , $content = null ) {
extract( shortcode_atts(
array(
'class' => '',
), $atts )
);
$classtest = "";
if($class != "") {
$classtest = ' ' . $class;
};
// Code
return '<th class="' . $classtest . '">' . do_shortcode($content) . '</th>';
}
add_shortcode( 'theadcol', 'pure_table_head_column_shortcode' );
function pure_table_body_shortcode( $atts , $content = null ) {
extract( shortcode_atts(
array(
'class' => '',
), $atts )
);
$classtest = "";
if($class != "") {
$classtest = ' ' . $class;
};
// Code
return '<tbody class="' . $classtest . '">' . do_shortcode($content) . '</tbody>';
}
add_shortcode( 'tbody', 'pure_table_body_shortcode' );
function pure_table_body_row_shortcode( $atts , $content = null ) {
extract( shortcode_atts(
array(
'class' => '',
), $atts )
);
$classtest = "";
if($class != "") {
$classtest = ' ' . $class;
};
// Code
return '<tr class="' . $classtest . '">' . do_shortcode($content) . '</tr>';
}
add_shortcode( 'tbodyrow', 'pure_table_body_row_shortcode' );
function pure_table_body_col_shortcode( $atts , $content = null ) {
extract( shortcode_atts(
array(
'class' => '',
), $atts )
);
$classtest = "";
if($class != "") {
$classtest = ' ' . $class;
};
// Code
return '<td class="' . $classtest . '">' . do_shortcode($content) . '</td>';
}
add_shortcode( 'tbodycol', 'pure_table_body_col_shortcode' );
// Adding TinyMCE Buttons
add_action('init', 'add_button');
@@ -104,7 +217,7 @@ function add_button() {
}
}
function register_button($buttons) {
array_push($buttons, "rowfluid","column","thebutton"); // For each button add to the grid
array_push($buttons, "rowfluid","column","thebutton",'table'); // For each button add to the grid
return $buttons;
}
function add_plugin($plugin_array) {

0 comments on commit 982cd7a

Please sign in to comment.