Created
December 23, 2017 11:02
-
-
Save techjewel/f5ceed49de1821f631a9ab583905c6fb 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 | |
function addInlineVars($vars, $table_id) { | |
if(function_exists('wp_add_inline_script')) { | |
wp_add_inline_script( 'script_handle', 'window.ninja_footables.tables["table_'.$table_id.'"] = '.$vars.';'); | |
} else { | |
add_action('wp_footer', function () use ($vars, $table_id) { | |
?> | |
<script type="text/javascript"> | |
window.ninja_footables.tables["table_<?php echo $table_id;?>"] = <?php echo $vars ?>; | |
</script> | |
<?php | |
}, 100); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment