I want to add a new checkbox field inside Publish block in add/edit post page. Does anyone have idea how to do that ?
I have finally found the solution. I hope it will be of good use for somebody.
add_action( 'post_submitbox_misc_actions', 'publish_in_frontpage' );
function publish_in_frontpage($post)
{
$value = get_post_meta($post->ID, '_publish_in_frontpage', true);
echo '
'
. ''
.'';
}
function save_postdata($postid)
{
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return false;
if ( !current_user_can( 'edit_page', $postid ) ) return false;
if(empty($postid) || $_POST['post_type'] != 'article' ) return false;
if($_POST['action'] == 'editpost'){
delete_post_meta($postid, 'publish_in_frontpage');
}
add_post_meta($postid, 'publish_in_frontpage', $_POST['publish_in_frontpage']);
}