Skip to content

Instantly share code, notes, and snippets.

@techjewel
Last active May 20, 2020 15:53
Show Gist options
  • Save techjewel/ccc54f4b84eba574b9d261382be6a693 to your computer and use it in GitHub Desktop.
Save techjewel/ccc54f4b84eba574b9d261382be6a693 to your computer and use it in GitHub Desktop.
Show Ninja Tables On Admin settings Page
<?php
/*
* By Default Ninja Tables does not work if you want to render table on
* admim panel. Add this following php code in your theme's functions.php file to make it work
*/
add_action('ninja_table_before_render_table_source', function ($table, $table_vars, $tableArray) {
if(is_admin()) {
add_action('admin_footer', function () use ($table_vars, $tableArray) {
?>
<script type="text/javascript">
window['<?php echo $table_vars['instance_name'];?>'] = <?php echo json_encode($table_vars, true); ?>
</script>
<?php
});
}
}, 10, 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment