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.
The module comes with additional settings that allows an advanced control over post types.
Setting | Description |
Front: Archive Posts per page | Set posts per page |
Front: Archive Order/Orderby | Set order/orderby setting |
Front: Single Template | Set custom template. Example: my-single.php |
Front: Archive Template | Set custom template: Example: my-archive.php |
Admin: List Posts Per Page | Set posts per page |
Admin: List Order/Order by | Set order/orderby setting |
Admin: Archive Page | Add an Archive Option Page under the post type menu. See Post Type Archive location |
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',
));
}
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'){
// set front: posts per page
$args['acfe_archive_ppp'] = 999;
}
// return
return $args;
}