Awesome WordPress Snippet to Debug and See all Custom Post Meta Elements

Ran across this script earlier today.

It helped be see a huge list of custom post fields aka, wordpress post meta, to use in a WordPress Custom Post template.

Place it in the single.php or custom page template loop and you can echo out all of theĀ availableĀ post variables.

<h3>All Post Meta</h3>

<?php $getPostCustom=get_post_custom(); // Get all the data ?>

<?php
    foreach($getPostCustom as $name=>$value) {

        echo "<strong>".$name."</strong>"."  =>  ";

        foreach($value as $nameAr=>$valueAr) {
                echo "<br />     ";
                echo $nameAr."  =>  ";
                echo var_dump($valueAr);
        }

        echo "<br /><br />";

    }
?>

I highly recommend saving it.

Once you echo out all of your custom post meta you can set up conditional logic like:

<?php if (get_post_meta($post->ID, 'landing_page_checkbox', true) == "") {
  echo "#menu {display:none;}"; } ?>

This code above is hiding my sites navigation is the custom meta box is checked.