How to create a new post type in WordPress

To create a new post type in WordPress open function.php file from current active folder
add below code and update

function custom_post_type() {
 
// Set UI labels for Custom Post Type
    $labels = array(
        'name'                => _x( 'Resources', 'Post Type General Name', 'twentythirteen' ),
        'singular_name'       => _x( 'Resources', 'Post Type Singular Name', 'twentythirteen' ),
        'menu_name'           => __( 'Resources', 'twentythirteen' ),
        'parent_item_colon'   => __( 'Parent Resources', 'twentythirteen' ),
        'all_items'           => __( 'All Resources', 'twentythirteen' ),
        'view_item'           => __( 'View Resource', 'twentythirteen' ),
        'add_new_item'        => __( 'Add New Resource', 'twentythirteen' ),
        'add_new'             => __( 'Add New', 'twentythirteen' ),
        'edit_item'           => __( 'Edit Resources', 'twentythirteen' ),
        'update_item'         => __( 'Update Resources', 'twentythirteen' ),
        'search_items'        => __( 'Search Resources', 'twentythirteen' ),
        'not_found'           => __( 'Not Found', 'twentythirteen' ),
        'not_found_in_trash'  => __( 'Not found in Trash', 'twentythirteen' ),
    );
     
// Set other options for Custom Post Type
     
    $args = array(
        'label'               => __( 'Resources', 'twentythirteen' ),
        'description'         => __( 'Resources info', 'twentythirteen' ),
        'labels'              => $labels,
        // Features this CPT supports in Post Editor
        'supports'            => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
        // You can associate this CPT with a taxonomy or custom taxonomy. 
   
     
        'rewrite' => array('slug' => '%types%'),
      //  'rewrite' => false,
      //     'taxonomies'          => array('topics', 'types', 'industry' ),

        /* A hierarchical CPT is like Pages and can have
        * Parent and child items. A non-hierarchical CPT
        * is like Posts.
        */ 
        'hierarchical'        => true,
        'public'              => true,
        'show_ui'             => true,
        'show_in_menu'        => true,
        'show_in_nav_menus'   => true,
        'show_in_admin_bar'   => true,
        'menu_position'       => 5,
        'can_export'          => true,
        'has_archive'         => true,
        'exclude_from_search' => false,
        'publicly_queryable'  => true,
        'capability_type'     => 'post',
    );
     
    // Registering your Custom Post Type
    register_post_type( 'resources', $args );
 
}

 
add_action( 'init', 'custom_post_type', 0 );

It will create a Resources menu in your admin side their you can view or update custom post Resources

How to add auto redirect to https in wordpress

TO add add auto redirect to https in WordPress.

Open .htaccess files from home directory

add below code and upload

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

It look like like full htaccess

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# END WordPress

It will do auto redirect to https in wordpress

How to display working php page name in WordPress ?

To display display working php page name in WordPress
add below code in header.php inside theme folder

 echo  get_page_template()."gggggggggg";
     exit;

See out put

 OUTPUT "/wp-content/themes/twentyseventeen/pages.phgggggggg"

default build in functon is located inside ‘wp-includes/template.php’ folder

function get_page_template() {
    $id = get_queried_object_id();
    $template = get_page_template_slug();
    $pagename = get_query_var('pagename');
 
    if ( ! $pagename && $id ) {
        // If a static page is set as the front page, $pagename will not be set. Retrieve it from the queried object
        $post = get_queried_object();
        if ( $post )
            $pagename = $post->post_name;
    }
 
    $templates = array();
    if ( $template && 0 === validate_file( $template ) )
        $templates[] = $template;
    if ( $pagename ) {
        $pagename_decoded = urldecode( $pagename );
        if ( $pagename_decoded !== $pagename ) {
            $templates[] = "page-{$pagename_decoded}.php";
        }
        $templates[] = "page-{$pagename}.php";
    }
    if ( $id )
        $templates[] = "page-{$id}.php";
    $templates[] = 'page.php';
 
    return get_query_template( 'page', $templates );
}

How to add a display Title before the Enter title here field wordpress admin post

To add display Title before title field in wordpress admin post

1) Open your theme functions page
add below code

 function ps_edit_form_top() 
 { 
echo ' </code></pre> <h2>Post Name</h2> ';
 } 

add_action( 'edit_form_top', 'ps_edit_form_top');

To add display Title before Content Editor field in wordpress admin post

add below code

function add_content_before_editor_post()
{
 echo '</pre><h2>Content/Description</h2>'; 
} 
add_action('edit_form_after_title', 'add_content_before_editor_post' );