Dynamic Post Types

The Dynamic Post Types module allows you to register and manage custom post types from your WordPress admin, in Tools > Post Types menu.

All native post types settings can be set within the UI. ACF Extended also adds more advanced settings allowing to manage posts per page, order etc…

Advanced Settings

The module comes with additional settings that allows an advanced control over post types.

SettingDescription
Front: Archive Posts per pageSet posts per page
Front: Archive Order/OrderbySet order/orderby setting
Front: Single TemplateSet custom template. Example: my-single.php
Front: Archive TemplateSet custom template: Example: my-archive.php
Admin: List Posts Per PageSet posts per page
Admin: List Order/Order bySet order/orderby setting
Admin: Archive PageAdd an Archive Option Page under the post type menu. See Post Type Archive location

Export/Import Post Types

It is possible to export and import Post Types in a Json file using the ACF > Tools menu. Post Types can also be exported in PHP format, to manually register them in the functions.php file. Those tools are also available directly within the Dynamic Post Types UI.

Register Post Types in PHP

Post Types can be registered using register_post_type() and benefit from ACF Extended advanced settings like “Front: Archive Posts per page” or “Admin: List Order/Order by”. See documentation. Usage example:

add_action('init', 'my_init');
function my_init(){
    
    register_post_type('my-post-type', array(
        
        // Label
        'label' => 'My Post Type',
        
        // Front: Archive
        'acfe_archive_template' => 'my-archive.php',
        'acfe_archive_ppp' => 999,
        'acfe_archive_orderby' => 'title',
        'acfe_archive_order' => 'ASC',
        
        // Front: Single
        'acfe_single_template' => 'my-single.php',
        
        // Admin
        'acfe_admin_archive' => true,
        'acfe_admin_ppp' => 999,
        'acfe_admin_orderby' => 'title',
        'acfe_admin_order' => 'ASC',
        
    ));
    
}

Existing Post Types

Advanced settings can be used in already existing post types using the register_post_type_args hook. See documentation. Usage example:

add_filter('register_post_type_args', 'my_post_type_args', 10, 2);
function my_post_type_args($args, $post_type){
    
    // Target "my-post-type"
    if($post_type !== 'my-post-type')
        return $args;
    
    // Set Front: Posts Per Page
    $args['acfe_archive_ppp'] = 999;
    
    // Return
    return $args;
    
}

Disable the module

This module is enabled by default. To disable it, you can use the following code:

add_action('acf/init', 'my_acfe_modules');
function my_acfe_modules(){

    // Disable Dynamic Post Types
    acfe_update_setting('modules/dynamic_post_types', false);
    
    // Or:
    acf_update_setting('acfe/modules/dynamic_post_types', false);
    
}