How can I make post fields required in WordPress?

Fairly simple using jQuery and global $typenow ex: add_action(‘admin_print_scripts-post.php’, ‘my_publish_admin_hook’); add_action(‘admin_print_scripts-post-new.php’, ‘my_publish_admin_hook’); function my_publish_admin_hook(){ global $typenow; if (in_array($typenow, array(‘post’,’page’,’mm_photo ‘))){ ?> <script language=”javascript” type=”text/javascript”> jQuery(document).ready(function() { jQuery(‘#post’).submit(function() { if (jQuery(“#set-post-thumbnail”).find(‘img’).size() > 0) { jQuery(‘#ajax-loading’).hide(); jQuery(‘#publish’).removeClass(‘button-primary-disabled’); return true; }else{ alert(“please set a featured image!!!”); jQuery(‘#ajax-loading’).hide(); jQuery(‘#publish’).removeClass(‘button-primary-disabled’); return false; } return false; }); }); </script> <?php } … Read more

Prevent publishing the post before setting a featured image?

The has_post_thumbnail() works for me, in WP versions 3.4.1 and other most recently. But in this logic, because the WP will publish the post even with exit or wp_die() or anything to terminate the PHP script. For prevent that the post stay with published status, you will need to update the post before terminate. Look … Read more

Display a post’s publish date from 2112

I had the same issue as you when I was dealing with events and wanted to show future events. Here is what I coded: add_action( ‘init’, ‘change_future_posts_to_post_now’ ); function change_future_posts_to_post_now() { remove_action(“future_post”, ‘_future_post_hook’); add_action(“future_post”, ‘publish_future_posts_now’, 2, 10); } function publish_future_posts_now($depreciated, $post) { wp_publish_post($post); } add_filter(‘posts_where’, ‘show_future_posts_where’, 2, 10); function show_future_posts_where($where, $that) { global $wpdb; if(“post” … Read more

Is it possible to Schedule Attachments in WordPress?

My idea is that you can setup a post date for the attachments. This can be done using attachment_fields_to_edit to show the UI (is possible use the touch_time internal function). After that, you can filter all the attachments query to show only the attachments with a past or current date. So add_action(‘load-post.php’, ‘setup_attachment_fields’); function setup_attachment_fields() … Read more