| 1 |
<?php |
| 2 |
/* ********************************************************** |
| 3 |
* TABLES |
| 4 |
* **********************************************************/ |
| 5 |
function osc_theme_os_table( $params, $content = null) { |
| 6 |
extract( shortcode_atts( array( |
| 7 |
'width' => '100%', |
| 8 |
'class' => '', |
| 9 |
'responsive' => 'false', |
| 10 |
), $params ) ); |
| 11 |
$content = str_replace("]<br />",']',$content); |
| 12 |
$out = '<table width="'.$width.'" class="table '.$class.'">'. do_shortcode($content) . '</table>'; |
| 13 |
$out = strtolower($responsive) == 'true' ? '<div class="table-responsive">'.$out.'</div>': $out; |
| 14 |
return $out; |
| 15 |
} |
| 16 |
add_shortcode( 'table', 'osc_theme_os_table' ); |
| 17 |
|
| 18 |
function osc_theme_os_table_head( $params, $content = null) { |
| 19 |
$out = '<thead><tr>'. do_shortcode($content) . '</tr></thead>'; |
| 20 |
return $out; |
| 21 |
} |
| 22 |
add_shortcode( 'table_head', 'osc_theme_os_table_head' ); |
| 23 |
|
| 24 |
|
| 25 |
function osc_theme_os_table_body( $params, $content = null) { |
| 26 |
$out = '<tbody>'. do_shortcode($content) . '</tbody>'; |
| 27 |
return $out; |
| 28 |
} |
| 29 |
add_shortcode( 'table_body', 'osc_theme_os_table_body' ); |
| 30 |
|
| 31 |
function osc_theme_os_table_row( $params, $content = null) { |
| 32 |
$out = '<tr>'; |
| 33 |
$out .= do_shortcode($content); |
| 34 |
$out .= '</tr>'; |
| 35 |
return $out; |
| 36 |
} |
| 37 |
add_shortcode( 'table_row', 'osc_theme_os_table_row' ); |
| 38 |
|
| 39 |
function osc_theme_os_row_column( $params, $content = null) { |
| 40 |
$out = '<td>'; |
| 41 |
$out .= $content; |
| 42 |
$out .= '</td>'; |
| 43 |
return $out; |
| 44 |
} |
| 45 |
add_shortcode( 'row_column', 'osc_theme_os_row_column' ); |
| 46 |
|
| 47 |
function osc_theme_os_th_column( $params, $content = null) { |
| 48 |
$out = '<th>'; |
| 49 |
$out .= $content; |
| 50 |
$out .= '</th>'; |
| 51 |
return $out; |
| 52 |
} |
| 53 |
add_shortcode( 'th_column', 'osc_theme_os_th_column' ); |
| 54 |
|