Created
November 6, 2013 14:32
-
-
Save gicolek/7336981 to your computer and use it in GitHub Desktop.
Get post id from shortcode
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 | |
add_shortcode( 'table', 'ssl_table_shortcode' ); | |
/** | |
* Render ACF table shortcode given several parameters | |
*/ | |
function ssl_table_shortcode($atts) { | |
global $post; | |
// extract the necessary attributes | |
extract( shortcode_atts( array( | |
'type' => '1', | |
), $atts ) ); | |
// get the html for given table type | |
switch ( $type ) { | |
case '1': | |
$out = ssl_tab_one( $post->id ); | |
break; | |
case '2': | |
$out = ssl_tab_two( $post->id ); | |
break; | |
case '3': | |
$out = ssl_tab_three( $post->id ); | |
break; | |
} | |
return $out; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment