Logo

Office Address

123/A, Miranda City Likaoli
Prikano, Dope

Phone Number

+0989 7876 9865 9

+(090) 8765 86543 85

Email Address

info@example.com

example.mail@hum.com

How to Create Custom Post type without a plugin?

How to Create Custom Post type without a plugin?

WordPress is a beat Content management System website that provides more than a blog. Users can create any type of website with the WordPress CMS. In WordPress, the most powerful feature is custom post type. WP has default create posts and pages. However, if you would like to have more than posts and pages on your website then you can add post type. That is a custom post type where you can specify custom posts for blogs, testimonials, and portfolios, etc...

When Do You Need a Custom Post Tag or Taxonomy in WordPress?

In this link, we have explained what is the use and advantage of Custom Post Tag or Taxonomy in WordPress

Let's create a custom post type in WordPress

Add this code in the function.php file. It will create a custom post type called 'portfolio'

add_action('init', 'analytics_post_type_register');

function analytics_post_type_register() {
register_post_type(
        'portfolio',
        array(
            'label' => 'Portfolio',
            'singular_label' => 'Portfolio',
            'public' => true,
            'show_ui' => true,
            'menu_icon' => get_stylesheet_diractory_uri() . '/images/homeoptions-icon.png',
            'capability_type' => 'post',
            'taxonomies'  => array( 'category',’tags’ ),
            'hierarchical' => false,
            'rewrite' => true,            
            'show_in_nav_menus' => false,
            'exclude_from_search' => true,
            'supports' => array('title', 'editor', 'author','revisions','thumbnail',)
        )
    ); 
}

Choose Support Fields based on your requirement

Supports - 'supports' => array('title', 'editor', 'author','revisions','thumbnail',)

Title - Will Display Title in Custom post type.

Editor - Will Display Editor in Custom post type.

Author - Will Enable Author in Custom post type.

Revisions - Will Enable Revisions in Custom post type.

Thumbnail - Will Enable Thumbnail in Custom post type.

To Enable Tags and Category use the Following

'taxonomies'  => array( 'category', ‘tags’ )
 

Tags

  • WordPress create custom post type programmatically

  • How to create custom post type in WordPress without a plugin

  • How to show custom post type in frontend in WordPress

  • WordPress create custom post type on plugin activation
  • Create custom post type WordPress without a plugin
  • How to display custom post type in WordPress

  • Custom post type generator

Related Posts

PHP CodeIgniter - Basic CRUD operation with MySQL Database with example

PHP CodeIgniter - Basic CRUD operation with MySQL Database with example

In this Post PHP CodeIgniter 4 instructional exercise, I will tell you the fundamental CRUD usefulness with MySQL Database.  Muck is an abbreviation for Create, Read, Update, and Delete inform

Read More
Advantage of Offshore IT Services

Advantage of Offshore IT Services

Blazingcoders is a offshore Website Design and Web Development Company, India. We are working with many of our offshore and outsource overseas clients. who is o

Read More
Fireworks vs Photoshop – Where to use what?

Fireworks vs Photoshop – Where to use what?

It’s over the years that we heard about the Adobe Photoshop. It was a new software that helped all types of creatives designs. Yet, as it customary with technological progress, there is always i

Read More