Tag Info

Hot answers tagged

2

When adding a metabox, the metabox itself isn't saved in the database. It's loaded from the plugin code that is written, then it's up to you to fill it with appropriate values. You don't have to create additional fields in the DB. There is a function: update_post_meta($post_id, $meta_key, $meta_value); In your case you might do something like: ...


2

Although the new orderby parameter is great in WP_Query, it does not support multiple orderby for multiple meta_key's. I've went through a couple of scenarios and even went and digged into trac and make and came up with the following make.wordpress.org A more powerful orderby in wordpress 4.0 trac ticket #17065 None of the issues regarding this very ...


1

From your comments, this only happens when the fields are left empty. This means that the particular field does not get set. As stated in my comments, you should first check if a field is set before you try to use it. In the first block of code, you have the following three lines <td><input type="text" class="widefat" name="name[]" ...


1

Inside the loop, you can check the custom field with get_post_meta. Like this. If custom field randomname exists then it will show it's value otherwise it will print <div class="name">content</div> <?php if ( get_post_meta( $post->ID, 'randomname', true ) ) { echo get_post_meta( $post->ID, 'randomname', true ); } ...



Only top voted, non community-wiki answers of a minimum length are eligible