Skip to content

Instantly share code, notes, and snippets.

@alokstha1
Created March 1, 2016 10:52
Show Gist options
  • Save alokstha1/a4e25e934260202c466c to your computer and use it in GitHub Desktop.
Save alokstha1/a4e25e934260202c466c to your computer and use it in GitHub Desktop.
Wp Subtitle
<?php
add_action( 'edit_form_after_title', 'cpm_add_subtitle_field');
function cpm_add_subtitle_field() {
global $post;
echo '<input type="hidden" name="wp_noncename" id="wp_noncename" value="' . wp_create_nonce( 'wp-subtitle' ) . '" />';
echo '<div id="subtitlediv" class="top">';
echo '<div id="subtitlewrap">';
echo '<input type="text" id="cpmsubtitle" name="cpm_subtitle" value="' . esc_attr( get_post_meta( $post->ID, 'sub_title_meta', true ) ) . '" autocomplete="off" placeholder="' . esc_attr( __( 'Enter subtitle here' ) ) . '" />';
echo '</div></div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment