Created
July 30, 2014 15:21
-
-
Save emaildano/a84a46b43c622c269768 to your computer and use it in GitHub Desktop.
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 | |
// Layout Option: Table via Tablepress | |
// Init Post Object | |
$postobject = get_sub_field('table'); | |
$post = $postobject; | |
setup_postdata( $post ); | |
// tablepress plugin query / args | |
// get ACF saved data. | |
$post_obj = get_sub_field( 'table' ); | |
// get the post-table pair json data | |
$table_json = get_option( 'tablepress_tables' ); | |
// json decode to array | |
$json_dec = json_decode( $table_json, true ); | |
// get the pair data | |
$post_table = $json_dec['table_post']; | |
// flip the key/value of the array | |
$flip = array_flip( $post_table ); | |
// table args | |
$args = array( | |
'id' => $flip[$post_obj->ID] | |
); ?> | |
<section> | |
<div class="tablepress table-responsive"> | |
<?php | |
get_template_part('templates/page-text-styles/body-copy'); | |
tablepress_print_table( $args); | |
?> | |
</div> | |
</section> | |
<?php // Reset data from Post Object | |
wp_reset_postdata(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment