Skip to content

Instantly share code, notes, and snippets.

@nfreader
Created March 13, 2012 17:59
Show Gist options
  • Save nfreader/2030299 to your computer and use it in GitHub Desktop.
Save nfreader/2030299 to your computer and use it in GitHub Desktop.
<?php if ( current_user_can('manage_options')) { ?>
<div style="position: absolute; top: 10px; left: 10px;">
<a href="#" class="btn btn-danger" data-toggle="modal" data-target="#debug" style="">Show Loop</a> <a href="#" class="btn btn-danger" data-toggle="modal" data-target="#conditions" style="">Show Conditionals</a>
</div>
<div class="modal hide fade" id="debug">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>Debug Info</h3>
</div>
<div class="modal-body">
<p>
<table class="table table-striped table-bordered table-condensed">
<tr>
<td>ID</td>
<td><?php echo $post->ID;?></td>
</tr>
<tr>
<td>post_author</td>
<td><?php echo $post->post_author;?></td>
</tr>
<tr>
<td>post_date</td>
<td><?php echo $post->post_date;?></td>
</tr>
<tr>
<td>post_date_gmt</td>
<td><?php echo $post->post_date_gmt;?></td>
</tr>
<tr>
<td>post_content</td>
<td><?php echo $post->post_content;?></td>
</tr>
<tr>
<td>post_title</td>
<td><?php echo $post->post_title;?></td>
</tr>
<tr>
<td>post_category</td>
<td><?php echo $post->post_category;?></td>
</tr>
<tr>
<td>post_excerpt</td>
<td><?php echo $post->post_excerpt;?></td>
</tr>
<tr>
<td>post_status</td>
<td><?php echo $post->post_status;?></td>
</tr>
<tr>
<td>post_password</td>
<td><?php echo $post->post_password;?></td>
</tr>
<tr>
<td>post_name</td>
<td><?php echo $post->post_name;?></td>
</tr>
<tr>
<td>to_ping</td>
<td><?php echo $post->to_ping;?></td>
</tr>
<tr>
<td>pinged</td>
<td><?php echo $post->pinged;?></td>
</tr>
<tr>
<td>post_modified</td>
<td><?php echo $post->post_modified;?></td>
</tr>
<tr>
<td>post_modified_gmt</td>
<td><?php echo $post->post_modified_gmt;?></td>
</tr>
<tr>
<td>post_content_filtered</td>
<td><?php echo $post->post_content_filtered;?></td>
</tr>
<tr>
<td>post_parent</td>
<td><?php echo $post->post_parent;?></td>
</tr>
<tr>
<td>guid</td>
<td><?php echo $post->guid;?></td>
</tr>
<tr>
<td>menu_order</td>
<td><?php echo $post->menu_order;?></td>
</tr>
<tr>
<td>post_type</td>
<td><?php echo $post->post_type;?></td>
</tr>
<tr>
<td>post_mime_type</td>
<td><?php echo $post->post_mime_type;?></td>
</tr>
<tr>
<td>post_comment_count</td>
<td><?php echo $post->comment_count;?></td>
</tr>
</table>
</p>
</div>
<div class="modal-footer">
<a href="#" class="btn">Close</a>
</div>
</div>
<div class="modal hide fade" id="conditions">
<div class="modal-header">
<a class="close" data-dismiss="modal">×</a>
<h3>Conditional Loops</h3>
</div>
<div class="modal-body">
<p>
<table class="table table-striped table-bordered table-condensed">
<tr>
<td><code>is_home()</code></td>
<td><?php if (is_home()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<tr>
<td><code>is_front_page()</code></td>
<td><?php if (is_front_page()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<tr>
<td><code>is_single()</code></td>
<td><?php if (is_single()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<tr>
<td><code>is_sticky()</code></td>
<td><?php if (is_sticky()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<tr>
<td><code>comments_open()</code></td>
<td><?php if (comments_open()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<tr>
<td><code>pings_open()</code></td>
<td><?php if (pings_open()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<tr>
<td><code>is_page()</code></td>
<td><?php if (is_page()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<tr>
<td><code>is_page_template()</code></td>
<td><?php if (is_page_template()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<tr>
<td><code>is_category()</code></td>
<td><?php if (is_category()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<tr>
<td><code>is_tag()</code></td>
<td><?php if (is_tag()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<tr>
<td><code>is_author()</code></td>
<td><?php if (is_author()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<td><code>is_date()</code></td>
<td><?php if (is_date()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<tr>
<td><code>is_archive()</code></td>
<td><?php if (is_archive()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<td><code>is_search()</code></td>
<td><?php if (is_search()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<tr>
<td><code>is_404()</code></td>
<td><?php if (is_404()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<tr>
<td><code>is_paged()</code></td>
<td><?php if (is_paged()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<td><code>is_attachment()</code></td>
<td><?php if (is_attachment()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<td><code>is_singular()</code></td>
<td><?php if (is_singular()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<td><code>is_preview()</code></td>
<td><?php if (is_preview()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
<td><code>has_excerpt()</code></td>
<td><?php if (has_excerpt()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
</tr>
<td><code>in_the_loop()</code></td>
<td><?php if (in_the_loop()) {echo '<span class="label label-success">True</span>';} else {echo '<span class="label label-important">False</span>';} ?></td>
</tr>
</table>
</p>
</div>
<div class="modal-footer">
<a href="#" class="btn">Close</a>
</div>
</div>
<?php } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment