ID, $this->slug, true );
if( (bool) $toggle ){
return true;
} else {
return false;
}
} else {
return false;
}
} // is_hidden()
public function head_insert(){
if( $this->is_hidden() ){ ?>
afterHead = true;
} // head_insert()
public function add_box(){
$posttypes = array( 'post', 'page' );
foreach ( $posttypes as $posttype ){
add_meta_box( $this->slug, 'Hide Title', array( $this, 'build_box' ), $posttype, 'side' );
}
} // add_box()
public function build_box( $post ){
$value = get_post_meta( $post->ID, $this->slug, true );
$checked = '';
if( (bool) $value ){ $checked = ' checked="checked"'; }
wp_nonce_field( $this->slug . '_dononce', $this->slug . '_noncename' );
?>
is_hidden() && $content == $this->title && $this->afterHead ){
$content = '' . $content . '';
}
return $content;
} // wrap_title()
public function load_scripts(){
// Grab the title early in case it's overridden later by extra loops.
global $post;
$this->title = $post->post_title;
if( $this->is_hidden() ){
wp_enqueue_script( 'jquery' );
}
} // load_scripts()
public function on_save( $postID ){
if ( ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
|| !isset( $_POST[ $this->slug . '_noncename' ] )
|| !wp_verify_nonce( $_POST[ $this->slug . '_noncename' ], $this->slug . '_dononce' ) ) {
return $postID;
}
$old = get_post_meta( $postID, $this->slug, true );
$new = $_POST[ $this->slug ] ;
if( $old ){
if ( is_null( $new ) ){
delete_post_meta( $postID, $this->slug );
} else {
update_post_meta( $postID, $this->slug, $new, $old );
}
} elseif ( !is_null( $new ) ){
add_post_meta( $postID, $this->slug, $new, true );
}
return $postID;
} // on_save()
public function on_delete( $postID ){
delete_post_meta( $postID, $this->slug );
return $postID;
} // on_delete()
public function set_selector( $selector ){
if( isset( $selector ) && is_string( $selector ) ){
$this->selector = $selector;
}
} // set_selector()
} // DojoDigitalHideTitle
$DojoDigitalHideTitle = new DojoDigitalHideTitle;
} // !class_exists( 'DojoDigitalHideTitle' )