• Resolved urbanprep

    (@urbanprep)


    I’m not able to get the custom post type to display on the web page. Can someone advise me as to what I may be missing?

    I originally placed this code in the functions.php file:

    function pluginize_display_post_type_description( $post_type_providers = 'providers' ) {
    $mytype = get_post_type_object( $post_type_providers )
    if ( ! empty( $mytype ) ) {
    echo $the_post_type->description;
    }
    }

    When that didn’t work, I removed that and added this:

    function cptui_register_my_cpts() {
    /**
    * Post Type: Providers.
    */

    $labels = [
    "name" => esc_html__( "Providers", "hello-elementor" ),
    "singular_name" => esc_html__( "Provider", "hello-elementor" ),
    ];

    $args = [
    "label" => esc_html__( "Providers", "hello-elementor" ),
    "labels" => $labels,
    "description" => "",
    "public" => true,
    "publicly_queryable" => true,
    "show_ui" => true,
    "show_in_rest" => false,
    "rest_base" => "",
    "rest_controller_class" => "WP_REST_Posts_Controller",
    "rest_namespace" => "wp/v2",
    "has_archive" => false,
    "show_in_menu" => true,
    "show_in_nav_menus" => true,
    "delete_with_user" => false,
    "exclude_from_search" => false,
    "capability_type" => "post",
    "map_meta_cap" => true,
    "hierarchical" => false,
    "can_export" => true,
    "rewrite" => [ "slug" => "providers", "with_front" => true ],
    "query_var" => true,
    "supports" => [ "title", "editor", "thumbnail" ],
    "taxonomies" => [ "disciplines" ],
    "show_in_graphql" => false,
    ];

    register_post_type( "providers", $args );

    /**
    * Post Type: Leaders.
    */

    $labels = [
    "name" => esc_html__( "Leaders", "hello-elementor" ),
    "singular_name" => esc_html__( "Leader", "hello-elementor" ),
    ];

    $args = [
    "label" => esc_html__( "Leaders", "hello-elementor" ),
    "labels" => $labels,
    "description" => "",
    "public" => true,
    "publicly_queryable" => true,
    "show_ui" => true,
    "show_in_rest" => false,
    "rest_base" => "",
    "rest_controller_class" => "WP_REST_Posts_Controller",
    "rest_namespace" => "wp/v2",
    "has_archive" => false,
    "show_in_menu" => true,
    "show_in_nav_menus" => true,
    "delete_with_user" => false,
    "exclude_from_search" => false,
    "capability_type" => "post",
    "map_meta_cap" => true,
    "hierarchical" => false,
    "can_export" => true,
    "rewrite" => [ "slug" => "leadership", "with_front" => true ],
    "query_var" => true,
    "supports" => [ "title", "editor", "thumbnail" ],
    "show_in_graphql" => false,
    ];

    register_post_type( "leadership", $args );

    /**
    * Post Type: Board Members.
    */

    $labels = [
    "name" => esc_html__( "Board Members", "hello-elementor" ),
    "singular_name" => esc_html__( "Board Member", "hello-elementor" ),
    ];

    $args = [
    "label" => esc_html__( "Board Members", "hello-elementor" ),
    "labels" => $labels,
    "description" => "",
    "public" => true,
    "publicly_queryable" => true,
    "show_ui" => true,
    "show_in_rest" => false,
    "rest_base" => "",
    "rest_controller_class" => "WP_REST_Posts_Controller",
    "rest_namespace" => "wp/v2",
    "has_archive" => false,
    "show_in_menu" => true,
    "show_in_nav_menus" => true,
    "delete_with_user" => false,
    "exclude_from_search" => false,
    "capability_type" => "post",
    "map_meta_cap" => true,
    "hierarchical" => false,
    "can_export" => true,
    "rewrite" => [ "slug" => "boardofdirectors", "with_front" => true ],
    "query_var" => true,
    "supports" => [ "title", "editor", "thumbnail" ],
    "taxonomies" => [ "bordroles" ],
    "show_in_graphql" => false,
    ];

    register_post_type( "boardofdirectors", $args );

    /**
    * Post Type: Jobs.
    */

    $labels = [
    "name" => esc_html__( "Jobs", "hello-elementor" ),
    "singular_name" => esc_html__( "Job", "hello-elementor" ),
    "menu_name" => esc_html__( "My Jobs", "hello-elementor" ),
    "all_items" => esc_html__( "All Jobs", "hello-elementor" ),
    "add_new" => esc_html__( "Add new", "hello-elementor" ),
    "add_new_item" => esc_html__( "Add new Job", "hello-elementor" ),
    "edit_item" => esc_html__( "Edit Job", "hello-elementor" ),
    "new_item" => esc_html__( "New Job", "hello-elementor" ),
    "view_item" => esc_html__( "View Job", "hello-elementor" ),
    "view_items" => esc_html__( "View Jobs", "hello-elementor" ),
    "search_items" => esc_html__( "Search Jobs", "hello-elementor" ),
    "not_found" => esc_html__( "No Jobs found", "hello-elementor" ),
    "not_found_in_trash" => esc_html__( "No Jobs found in trash", "hello-elementor" ),
    "parent" => esc_html__( "Parent Job:", "hello-elementor" ),
    "featured_image" => esc_html__( "Featured image for this Job", "hello-elementor" ),
    "set_featured_image" => esc_html__( "Set featured image for this Job", "hello-elementor" ),
    "remove_featured_image" => esc_html__( "Remove featured image for this Job", "hello-elementor" ),
    "use_featured_image" => esc_html__( "Use as featured image for this Job", "hello-elementor" ),
    "archives" => esc_html__( "Job archives", "hello-elementor" ),
    "insert_into_item" => esc_html__( "Insert into Job", "hello-elementor" ),
    "uploaded_to_this_item" => esc_html__( "Upload to this Job", "hello-elementor" ),
    "filter_items_list" => esc_html__( "Filter Jobs list", "hello-elementor" ),
    "items_list_navigation" => esc_html__( "Jobs list navigation", "hello-elementor" ),
    "items_list" => esc_html__( "Jobs list", "hello-elementor" ),
    "attributes" => esc_html__( "Jobs attributes", "hello-elementor" ),
    "name_admin_bar" => esc_html__( "Job", "hello-elementor" ),
    "item_published" => esc_html__( "Job published", "hello-elementor" ),
    "item_published_privately" => esc_html__( "Job published privately.", "hello-elementor" ),
    "item_reverted_to_draft" => esc_html__( "Job reverted to draft.", "hello-elementor" ),
    "item_scheduled" => esc_html__( "Job scheduled", "hello-elementor" ),
    "item_updated" => esc_html__( "Job updated.", "hello-elementor" ),
    "parent_item_colon" => esc_html__( "Parent Job:", "hello-elementor" ),
    ];

    $args = [
    "label" => esc_html__( "Jobs", "hello-elementor" ),
    "labels" => $labels,
    "description" => "",
    "public" => true,
    "publicly_queryable" => true,
    "show_ui" => true,
    "show_in_rest" => true,
    "rest_base" => "",
    "rest_controller_class" => "WP_REST_Posts_Controller",
    "rest_namespace" => "wp/v2",
    "has_archive" => false,
    "show_in_menu" => true,
    "show_in_nav_menus" => true,
    "delete_with_user" => false,
    "exclude_from_search" => false,
    "capability_type" => "post",
    "map_meta_cap" => true,
    "hierarchical" => false,
    "can_export" => true,
    "rewrite" => [ "slug" => "jobs", "with_front" => true ],
    "query_var" => true,
    "supports" => [ "title", "editor" ],
    "show_in_graphql" => false,
    ];

    register_post_type( "jobs", $args );

    }

    add_action( 'init', 'cptui_register_my_cpts' );

    • This topic was modified 1 month, 3 weeks ago by urbanprep.
    • This topic was modified 1 month, 3 weeks ago by Kathryn Presner. Reason: put code in code block

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.