Sigmascripts
  • Marketing
    • Digital marketing
    • Seo
    • website
  • Seo Tools
    • keyword suggestion tool
    • plagiarism checker
    • WordPress Custom Post type generator
    • Backlink Maker
    • SItemap Generator
    • Domain age checker
    • Page size checker
  • Javascript
    • Jquery
  • PHP
  • WordPress
    • wordpress plugin
    • wordpress themes
  • Tips and trick
No Result
View All Result
Sigma Scripts
  • Marketing
    • Digital marketing
    • Seo
    • website
  • Seo Tools
    • keyword suggestion tool
    • plagiarism checker
    • WordPress Custom Post type generator
    • Backlink Maker
    • SItemap Generator
    • Domain age checker
    • Page size checker
  • Javascript
    • Jquery
  • PHP
  • WordPress
    • wordpress plugin
    • wordpress themes
  • Tips and trick
No Result
View All Result
Sigma Scripts
No Result
View All Result

create custom post type in wordpress in 2022

Abhishek Bhardwaj by Abhishek Bhardwaj
March 17, 2022
in website
0 0
1
Create custom post type in wordpress

Create custom post type in wordpress

1
SHARES
52
VIEWS
Share on FacebookShare on Twitter
Table Of Contents
  1. What is post type in wordpress?
  2. The two method are as follow:-
  3. 1. Create custom post type with the help of plugin.
  4. 2. Create custom post type without any plugin.
    • Create custom post type with the help of plugin
      • Custom Post Type UI
    • Create custom post type without any plugin.
  5. Conclusion

Do you want to learn to create custom post type in wordpress? There are 2 methods for that one with plugin and other is without plugin. Both methods are easy to use, but some require more work than others. Choose whichever method you prefer.

Before that, let’s discuss what is post type?

What is post type in wordpress?

Custom post types are content types similar to posts and pages in wordpress. A post type can be anything like products in woocommerce, Products is also custom type and let’s say we can create testinomials as custom post type.

ADVERTISEMENT

By default, WordPress comes with these post types:

  • Post
  • Page
  • Attachment
  • Nav Menu

Here, in this example we will create custom post type with name ‘courses’

The two method are as follow:-

1. Create custom post type with the help of plugin.

2. Create custom post type without any plugin.

Let’s talk about first method create custom post type with the help of plugin

Create custom post type with the help of plugin

There are some plugins available from those you can create custom post type

Custom Post Type UI

It’s a simple and plug & play plugin and you don’t need any coding knowledge to create a custom post type from this plugin. Once you install and activate the plugin. You can go to menu under CPT UI and click on Add/Edit post type.

here is the attach screenshot

create custom post type in wordpress in 2022
Click on Add/Edit post type

once you click on it  a form will appear
create custom post type in wordpress in 2022

As we are creating post type courses, type courses in post type slug, in plural label type courses too and for singular type course. Your custom post type has been created. You can create many custom post type with this plugin. Click here to download this plugin
There are many other plugins that can do the same type of job, but I’m adding this one because it is very simple and easy to use.

ADVERTISEMENT

Create custom post type without any plugin.

To create custom post type manually here is the code you can just copy paste the code in your theme function.php

function courses_post_type() {
$labels = array(
'name' => _x( 'Course', 'Post Type General Name', 'twentythirteen' ),
'singular_name' => _x( 'Course', 'Post Type Singular Name', 'twentythirteen' ),
'menu_name' => __( 'Courses', 'twentythirteen' ),
'all_items' => __( 'All Courses', 'twentythirteen' ),
'view_item' => __( 'View Course', 'twentythirteen' ),
'add_new_item' => __( 'Add New Course', 'twentythirteen' ),
'add_new' => __( 'Add New', 'twentythirteen' ),
'edit_item' => __( 'Edit Course', 'twentythirteen' ),
'update_item' => __( 'Update Course', 'twentythirteen' ),
'search_items' => __( 'Search Course', 'twentythirteen' ),
'not_found' => __( 'Not Found', 'twentythirteen' ),
'not_found_in_trash' => __( 'Not found in Trash', 'twentythirteen' ),
);

$args = array(
'label' => __( 'Courses', 'twentythirteen' ),
'description' => __( 'Courses review', 'twentythirteen' ),
'labels' => $labels,
// In SUpport you can add or remove what you want in your custom post type, like you want editor, feature image and different suppor
'supports' => array( 'title', 'editor', 'excerpt', 'author', 'thumbnail', 'comments', 'revisions', 'custom-fields', ),
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_icon' =>'dashicons-open-folder',
'menu_position' => 5,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'show_in_rest' => true,

// This is where we add taxonomies to our CPT
'taxonomies' => array( 'category' ),
);

// Registering your Custom Post Type
register_post_type( 'courses', $args );

}

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

Here I’ve created a function called courses_post_type I’ve put the label array and $args array in register_post_type which is an in-built wordpress function to register post type and $args is the parameter we pass in that function. and by calling add_action I’ve call my function courses_post_type which register the custom post type to wordpress admin.

Conclusion

I don’t support any plugin to create custom post type, You should use minimum WordPress plugins in your site, therefore by some code you can save a plugin to install in your site.

Checkout our free custom post type generator
Tags: create CPT in wordpresscreate custom post type without pluginhow to create custom post type in wordpress
Previous Post

Why website is important for your business in 2022

Next Post

How to increase memory limit in wordpress

Abhishek Bhardwaj

Abhishek Bhardwaj

Next Post
increase memory limit in wordpress

How to increase memory limit in wordpress

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

You might also like

How to make money blogging for beginners

How to make money blogging for beginners

March 8, 2023
What is Chat GPT?

What is Chat GPT ? What is Chat GPT used for?

February 24, 2023
programming languages

Best Programming Language For Web Development

October 19, 2022
on-page and off-page seo

On-page and Off-page SEO most Essential Factors 

October 14, 2022
copywriting

A Complete Guide of Freelance Copywriting

October 10, 2022
seo keywords

What are SEO Keywords? Types of SEO Keywords

September 28, 2022

Grow your online business presence with the best digital marketing strategy offered by Sigmascripts. You will get all about WordPress, digital marketing, SEO, etc. We deliver the best ideas to grow you through the Online platform.

Stay Connected

  • About us
  • Privacy Policy

© 2022 sigmascripts.com

No Result
View All Result
  • Marketing
    • Digital marketing
    • Seo
    • website
  • Seo Tools
    • keyword suggestion tool
    • plagiarism checker
    • WordPress Custom Post type generator
    • Backlink Maker
    • SItemap Generator
    • Domain age checker
    • Page size checker
  • Javascript
    • Jquery
  • PHP
  • WordPress
    • wordpress plugin
    • wordpress themes
  • Tips and trick

© 2022 sigmascripts.com

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In