Change post status by custom fields

All you need to do is to use save_post hook. Here’s how: function change_post_status_based_on_custom_field( $post_id ) { // If this is just a revision, don’t do anything. if ( wp_is_post_revision( $post_id ) ) return; // Get field value $value = get_post_meta( $post_id, ‘played’, true ); $status = $value ? ‘publish’ : ‘draft’; // If status … Read more

Identify and display the fact that user is admin next to username in comment section

From inside a comment Loop… $author_data = get_user_by(‘login’,$comment->comment_author); if (!empty($author_data)) { var_dump($author_data->roles); } $author_data->roles is an array so you will need to work out what you want to do with that. That is, print them all? Print the highest ranking role? if (array_intersect(array(‘administrator’,’moderator’),$author_data->roles)) { echo ‘admin’; } elseif (array_intersect(array(‘something’,’else’),$author_data->roles)) { echo ‘something else’; }

Enforce conditions only for draft posts using WyPiekacz, ignore pending and published posts

The check is invoked after a call to get_option( ‘wypiekacz_allow_skip_rules’ ). When you filter pre_option_wypiekacz_allow_skip_rules and returns something different than FALSE, it should stop the check early. Not tested. add_filter( ‘pre_option_wypiekacz_allow_skip_rules’, ‘wpse_100503_wypiekacz_for_drafts_only’ ); function wpse_100503_wypiekacz_for_drafts_only( $bool ) { if ( ‘draft’ === get_post_status( $GLOBALS[‘post’] ) ) return $bool; return 0; } To prevent the post … Read more

Show ‘add comment’ link for status updates in Twenty Thirteen

Open up the /wp-content/themes/twentythirteen/functions.php file and change the line $format_prefix = ( has_post_format( ‘chat’ ) || has_post_format( ‘status’ ) ) ? _x( ‘%1$s on %2$s’, ‘1: post format name. 2: date’, ‘twentythirteen’ ): ‘%2$s’; to $format_prefix = ( has_post_format( ‘chat’ ) || has_post_format( ‘status’ ) ) ? _x( ‘%1$s on %2$s – show/leave comments’, ‘1: … Read more