softmaji-header-wbg-min
softmaji-header-wbg-min
softmaji-blue-header-min
softmaji-blue-header-min
  • Home
  • Services
    • Website Designing
      • Responsive Website Design
      • Static Website Design
      • Website Redesign
      • Landing Page Design
    • Website Development
      • PHP Website Development
      • WordPress Website Development
      • Ecommerce Website Development
      • Custom Website Development
    • Digital Marketing
      • Google Adwords/PPC
      • Facebook Promotion
    • SEO Service
  • Trainings
    • Learn Web Development
    • Learn Graphics Design
    • Learn Business Communication Skills
  • Pricing
  • Portfolio
  • Events
  • Offers
  • Contact Us

How to create Custom Post Type or Custom Entries in WordPress

HomeHow to create Custom Post Type or Custom Entries in WordPress

Offer Expire Soon..


Only New User..


The Custom Post Type is basically a customized entry in WordPress, and this is a very useful feature for those who need to customize their website most of the time. By default, WordPress does not allow this types of customization in the entries, forcing us to use plugins or touch the code to create them and display them.

Although there are plugins that can solve the problem but it is always good to know what they do, if at some point we have to touch the code. So let’s see how to manually create the Custom Post Type in WordPress. An advanced step in customizing our website created with popular content management, as we advance in the article on static pages. However, in this tutorial, we also listed some of the WordPress plugins that allow us to customize the entries without getting into programming.

If we want to create a custom entry, we have to go to functions.php file of our WordPress theme where we add the following code.

As an example, let’s make an example of own entry called Journals:

// function will not be used before the ‘init’.

add_action ( ‘init’, ‘my_custom_init’);

my_custom_init function () {

$ Labels = array (

(‘General post type name’ ‘Journals’) ‘name’ => _x,

‘Singular_name’ => _x (‘Journal’, ‘post type singular name’),

‘Add_new’ => _x (‘Add new’ ‘Journal’),

‘Add_new_item’ => __ (‘Add New Journal’),

‘Edit_item’ => __ (‘Edit Journal’),

‘New_item’ => __ (‘New Journal’),

‘View_item’ => __ (‘See Journal’),

‘Search_items’ => __ (‘Search Journals’),

‘Not_found’ => __ (‘No Journal found’),

‘Not_found_in_trash’ => __ (‘No Journal found in the trash’),

‘Parent_item_colon’ => ”

);

// create an array to $ args

$ Args = array ( ‘labels’ => $ labels,

‘Public’ => true,

‘Publicly_queryable’ => true,

‘Show_ui’ => true,

‘Query_var’ => true,

‘Rewrite’ => true,

‘Capability_type’ => ‘post’,

‘Hierarchical’ => false,

‘Menu_position’ => null,

‘Supports’ => array (‘title’, ‘editor’, ‘author’, ‘thumbnail’, ‘excerpt’ ‘comments’)

);

register_post_type (‘Journal’, $ args);

}
This code is not too complicated and only need to change the text to display in the way that interests us.

With this, we will be creating a custom entry and that is already present on our desktop.

Ratings
If you look at the post we see that we have no taxonomy for journals. That is, we have no classification: No genres or authors.

To create taxonomies, we will need the following code:

// the init hooked in action and call the create_journal_taxonomies () function when starting

add_action ( ‘init’, ‘create_journal_taxonomies’, 0);

// we created two taxonomies, genre and author for the custom post type “journal”

create_journal_taxonomies function () {

// we add new taxonomy and do hierarchical (as the default categories)

$ Labels = array (

‘Name’ => _x (‘Genres’, ‘General taxonomy name’),

‘Singular_name’ => _x (‘Genre’, ‘taxonomy singular name’),

‘Search_items’ => __ (‘Search Genre’),

‘All_items’ => __ (‘All Genders’),

‘Parent_item’ => __ (‘Gender father’),

‘Parent_item_colon’ => __ (‘Gender father’),

‘Edit_item’ => __ (‘Edit Gender’),

‘Update_item’ => __ (‘Update Gender’),

‘Add_new_item’ => __ (‘Add new Gender’),

‘New_item_name’ => __ (‘name new Gender’),

);

register_taxonomy ( ‘genre’, array ( ‘journal’), array (

‘Hierarchical’ => true,

‘Labels’ => $ labels, / * this is where the labels $ variable are we created above using * /

‘Show_ui’ => true,

‘Query_var’ => true,

‘Rewrite’ => array (‘slug’ => ‘gender’),

));

// I add another taxonomy, this time it is not hierarchical, as tags.

$ Labels = array (

‘Name’ => _x (‘Writers’, ‘General taxonomy name’),

‘Singular_name’ => _x (‘writer’, ‘taxonomy singular name’),

‘Search_items’ => __ (‘Search Writers’),

‘Popular_items’ => __ (‘Popular writers’),

‘All_items’ => __ (‘All writers’),

‘Parent_item’ => null,

‘Parent_item_colon’ => null,

‘Edit_item’ => __ (‘Edit Writer’),

‘Update_item’ => __ (‘Update Writer’),

‘Add_new_item’ => __ (‘Add new writer’),

‘New_item_name’ => __ (‘Name of the new writer’),

‘Separate_items_with_commas’ => __ (‘Comma Separate Writers’),

‘Add_or_remove_items’ => __ (‘Add or remove Writers’),

‘Choose_from_most_used’ => __ (‘Choosing among the most used Writers’)

);

register_taxonomy ( ‘writer’, ‘journal’, array (

‘Hierarchical’ => false,

‘Labels’ => $ labels,

‘Show_ui’ => true,

‘Query_var’ => true,

‘Rewrite’ => array (‘slug’ => ‘writer’),

));

}
In this code, we refer to the customization of the entry you want to add taxonomies to, recalling must be added to functions.php file of our theme.

Custom Post Type Plugins
Then here are some of the selected plugins that can let you customize the entries.

Custom Post Type UI: Very intuitive and easy to use.
Toolset Types: In addition to creating custom entries, it allows us to create individualized taxonomies and fields.
Pods: A complete plugin that is previously mentioned in the list of other plugins, templates, and other features options.
If you are starting with WordPress, we recommend you to take a look at our post about 50 useful and recommended plugins for Getting Started with WordPress. If you have programming skills or want to know more about the WordPress, you can take advantage of our WordPress Category here (link).

Faizan Khan
12
Latest News
Prev PostHow to Create and Insert Tables into Posts and Pages in WordPressMay 14, 2024
Next PostHow do I connect to an SFTP server with FileZilla for File Transfer?May 14, 2024

Related items

Latest News

How To Install WordPress Blog?

Let’s see how to install WordPress blog on your WordPress hosting account. Let’s

Faizan Khan
14/05/2024
146
Latest News

How to Install a Theme in WordPress?

Steps to install a theme in WordPress: Log in to WordPress. Navigate to Appearance and cli

Faizan Khan
14/05/2024
130
Latest News

Fatal error: Allowed memory size of xxxx bytes exhausted (tried to allocate xx bytes)

WordPress is a free open source blogging tool. When posting a article OR uploading a image

Faizan Khan
14/05/2024
140
softmaji-header-wbg-min
SoftMaji is one of the affordable web development company in the web development industry. You don’t have to go searching anywhere for finding a reliable web development partner because we have crafted web development solutions that can fill the void left by others in the market.
Services
  • News Portal Development
  • Custom Website Development
  • PHP Website Development
  • Ecommerce Website Development
  • WordPress Website Development
Shortlinks
  • Blog
  • Offers
  • Events
  • Pricing
  • Reviews
  • Portfolio
  • Our Team
  • Payment Options
  • Explore Packages
Company
  • FAQ
  • Careers
  • Sitemap
  • Feedback
  • About Us
  • Contact Us
  • Privacy Policy
  • Terms & Conditions
  • Refund And Cancellation
Contact Us
4/40 Vipul Khand , Gomti Nagar Lucknow
Uttar Pradesh 226010
Landline - +915223162418
Email - hello@softmaji.in
Office Time Mon - Sat
(10:00AM - 5:00PM)
Sunday Close
+91 9795405324
Lucknow , Uttar Pradesh
Copyright © 2022. All Rights Reserved.