Add custom option to Standard Page Attributes Meta Box

Unfortunately not. The only way is to deregister the metabox, and then re-register it, supplying your own callback function which mimics the original metabox, but with your alterations (making sure the names of the inputs do not change). This method is outlined in these posts: custom post type taxonomies UI radiobuttons not checkboxes Custom-Taxonomy as … Read more

Saving Custom Field in Attachment Window in WordPress 3.5

I wanted to be able to add author information to my attachments and merged this code: http://www.billerickson.net/wordpress-add-custom-fields-media-gallery/ with the one you refer to. I Got it to work fully in the modal window via AJAX. The modified code is as follows: /** * Add Author Name and URL fields to media uploader * * @param … Read more

Date, Time, and Timezones

What is the purpose of the timezone setting in the Admin -> Settings section? Since WordPress handles time zone on its own (separately from native PHP functionality) that is where the setting made and result is stored in options. Whenever anything that works with timezones needs to happen, the time zone setting is retrieved and … Read more

If Custom Field is empty don’t display div

Try this: <?php $business_services = get_field( “services_for_businesses” ); //etc… ?> <div class=”section-title”>Services for Individuals</div> <div class=”section-text”> <?php the_field(‘services_for_individuals’) ?> </div> <?php if ( $business_services ) : ?> <div class=”section-title-business”>Services for Businesses</div> <div class=”section-text”> <?php echo $business_services; ?> </div> </div> <?php endif; ?> </div> Further abstract the code to meet your needs if you have more … Read more

How to handle a custom form in wordpress to submit to another page?

<form action=”<?php echo esc_url( admin_url(‘admin-post.php’) ); ?>” method=”post”> <input type=”hidden” name=”action” value=”your_action_name”> Add these in your form. Where admin-post.php will process your form. In that case based on the value of your_action_name that is provided by you, an action hook will get involved. Say for example if you add a hook like the following in … Read more

How do I search an array stored in a custom-field using WP_Query?

Searching inside a serialized array is difficult and inefficient– ie. slow. The following pure SQL will do it: SELECT * FROM `wp_postmeta` WHERE `meta_key` LIKE ‘daysonair’ AND `meta_value` LIKE ‘%thursday%’ LIMIT 0 , 100 Something like this should get WP_Query to do something similar: $args = array( ‘post_type’ => ‘post’, ‘meta_query’ => array( array( ‘key’ … Read more