wordpress/twentynineteen-child/functions.php
// This function is a shortcut for setting up post types
This function is a shortcut for setting up post types
This function is a shortcut for setting up post types
function customPostType($basicname, $title, $icon = 'dashicons-book', $public = true, $extraArgs = null)
{
    if ($public) {
        $supports = array('title', 'editor', 'excerpt', 'thumbnail', 'revisions');
    } else {
        $supports = array('title', 'thumbnail');
    }
    $singularName = makeSingularWord($basicname);
    $singularName = ucfirst($singularName);
    $args = array(
        'labels' => array(
            'name' => $title,
            'singular_name' => $singularName,
            'add_new' => "Add $singularName",
            'add_new_item' => "Add New $singularName",
            'new_item' => 'Add New'
        ),
        'label' => ucfirst($basicname),
        'public' => $public,
        'publicly_queryable' => $public,
        'show_in_rest' => true,
        'show_ui' => true,
        'query_var' => $public,
        'menu_icon' => $icon,
        'rewrite' => array('slug' => $basicname, 'with_front' => false),
        'capability_type' => 'post',
        'hierarchical' => false,
        'menu_position' => 6,
        'supports' => $supports,
        'has_archive' => false
    );
    if ($extraArgs) {
        $args = array_merge($args, $extraArgs);
    }
    register_post_type($basicname, $args);
}
function customPostType ( $ basicname , $ title , $ icon = 'dashicons-book' , $ public = true , $ extraArgs = null ) { if ( $ public ) { $ supports = array ( 'title' , 'editor' , 'excerpt' , 'thumbnail' , 'revisions' ) ; } else { $ supports = array ( 'title' , 'thumbnail' ) ; } $ singularName = makeSingularWord ( $ basicname ) ; $ singularName = ucfirst ( $ singularName ) ; $ args = array ( 'labels' => array ( 'name' => $ title , 'singular_name' => $ singularName , 'add_new' => " Add  $ singularName " , 'add_new_item' => " Add New  $ singularName " , 'new_item' => 'Add New' ) , 'label' => ucfirst ( $ basicname ) , 'public' => $ public , 'publicly_queryable' => $ public , 'show_in_rest' => true , 'show_ui' => true , 'query_var' => $ public , 'menu_icon' => $ icon , 'rewrite' => array ( 'slug' => $ basicname , 'with_front' => false ) , 'capability_type' => 'post' , 'hierarchical' => false , 'menu_position' => 6 , 'supports' => $ supports , 'has_archive' => false ) ; if ( $ extraArgs ) { $ args = array_merge ( $ args , $ extraArgs ) ; } register_post_type ( $ basicname , $ args ) ; }
This function is a shortcut for setting up post types
This function is a shortcut for setting up post types
// Generally title is the plural name