How Do I Order Custom Post in WordPress?

If you’re looking to create a custom post type in WordPress, you’ll need to first create a new file called custom.php and add the following code to it:

Then, you’ll need to add a new hook to your WordPress installation called ‘init’ and add the following code to it:

add_action( ‘init’, ‘custom_post_type_init’ );

function custom_post_type_init() {

register_post_type( ‘custom’, array(

‘name’ => ‘My Custom Post Type’,

‘label’ => __( ‘My Custom Post Type’, ‘wp-blog-header’ ),

‘description’ => __( ‘This is a custom post type.’, ‘wp-blog-header’ ),

‘public’ => true,

‘show_ui’ => true,

‘show_in_menu’ => true,

‘supports’ => array( ‘title’, ‘editor’, ‘thumbnail’ ),

‘taxonomies’ => array( ‘category’, ‘category-subcategory’ ),

‘rewrite’ => array(

array(

‘slug’ => ‘my-custom-post-type’,

‘method’ => ‘post’,

‘rewrite_rules’ => array(

‘title’ => __(‘My Custom Post Type – Edit’),

‘rewrite_title’ => _x( ‘My Custom Post Type – Edit’, ‘wp-post-title’ ),

),

)))

);

}

The ‘init’ hook will register your new custom post type and provide some basic configuration options. The ‘register_post_type’ function will take a few parameters:

name (required) – The name of your new custom post type

label (required) – The label that will be shown to users when they create a new post

description (required) – A brief description of the custom post type

public (optional) – Whether or not the custom post type is public

show_ui (optional) – Whether or not the custom post type should be displayed in the WordPress admin panel

show_in_menu (optional) – Whether or not the custom post type should be displayed in the WordPress menu

supports (optional) – An array of post type support options, including title , editor , and thumbnail

taxonomies (optional) – An array of taxonomies that the post type can be associated with

rewrite (optional) – An array of rewrite rules that will be applied to all posts of the custom post type

Once you’ve created your custom post type, you’ll need to add some posts to it. To do this, you’ll need to add a new file called custom.php and add the following code to it:

// Add your custom post types posts here.

include_once ‘custom.php’ ;

This file will contain the posts for your custom post type. You’ll need to include the ‘custom.

php’ file, and then add your posts inside of it.