ID, $this->hpt_slug, true );
if( (bool) $toggle ){return true;} else {return false;}}
else {return false;}
}
/*Function hptheadinseart for Hiding page title*/
public function hpt_hptheadinsert()
{ if( $this->hpt_ishidden() ){ ?>
hpt_afthead = true;
}
/*Function hptaddbox*/
public function hpt_hptaddbox(){
$posttypes = array( 'post', 'page' );
$args = array(
'public' => true,
'_builtin' => false,
);
$output = 'names';
$operator = 'and';
$post_types = get_post_types( $args, $output, $operator );
foreach ( $post_types as $post_type ) {
$posttypes[] = $post_type;
}
foreach ( $posttypes as $posttype ){add_meta_box( $this->hpt_slug, 'Hide Page and Post Title', array( $this, 'build_hptbox' ), $posttype, 'side' );}
}
/*Adding box in admindashboard*/
public function build_hptbox( $post ){
$value = get_post_meta( $post->ID, $this->hpt_slug, true );
$checked = '';
if( (bool) $value ){ $checked = ' checked="checked"'; }
wp_nonce_field( $this->hpt_slug . '_dononce', $this->hpt_slug . '_noncename' ); ?>
hpt_ishidden() && $hptcontent == $this->title && $this->hpt_afthead ){$hptcontent = '' . $hptcontent . '';
}return $hptcontent;
}
/*Script*/
public function hpt_hptloadscripts(){
global $post;
$this->title = $post->post_title;
if( $this->hpt_ishidden() ){wp_enqueue_script( 'jquery' );}
}
/*Autosave metabox*/
public function hpt_hptsave( $postID ){
if ( ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
|| !isset( $_POST[ $this->hpt_slug . '_noncename' ] )
|| !wp_verify_nonce( $_POST[ $this->hpt_slug . '_noncename' ], $this->hpt_slug . '_dononce' ) ) {
return $postID;
}
$old = get_post_meta( $postID, $this->hpt_slug, true );
$new = $_POST[ $this->hpt_slug ] ;
if( $old ){if ( is_null( $new ) ){delete_post_meta( $postID, $this->hpt_slug );} else { update_post_meta( $postID, $this->hpt_slug, $new, $old );}
} elseif ( !is_null( $new ) ){add_post_meta( $postID, $this->hpt_slug, $new, true );}
return $postID;
}
/*Delete metabox */
public function hpt_hptdelete( $postID ){delete_post_meta( $postID, $this->hpt_slug );return $postID;}
public function set_hpt_selector( $hpt_selector ){if( isset( $hpt_selector ) && is_string( $hpt_selector ) ){$this->hpt_selector = $hpt_selector;}
}
/*ENDclass Hide page title*/
}$hpt_hidepagetitle = new hpt_hidepagetitle;
}