Skip to content

Instantly share code, notes, and snippets.

@iwek
Created December 14, 2013 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iwek/7965851 to your computer and use it in GitHub Desktop.
Save iwek/7965851 to your computer and use it in GitHub Desktop.
wp query
<?php
//http://codex.wordpress.org/Class_Reference/wpdb
global $wpdb;
echo "<h2>Plugin Admin Page</h2>";
$arr = $wpdb->get_results("SELECT * FROM $wpdb->users");
echo '<div id="dt_example"><div id="container"><form><div id="demo">';
echo '<table cellpadding="0" cellspacing="0" border="0" class="display" id="example"><thead><tr>';
foreach ($arr[0] as $k => $v) {
echo "<td>".$k."</td>";
}
echo '</tr></thead><tbody>';
foreach($arr as $i=>$j){
echo "<tr>";
foreach ($arr[$i] as $k => $v) {
echo "<td>".$v."</td>";
}
echo "</tr>";
}
echo '</tbody></table>';
echo '</div></form></div></div>';
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
$('#example').dataTable();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment