Custom post type and displaying it on your main page.
-
I have created a custom post type called ‘project’. But how do I get the custom post types to display only on my main template? It’s a one page website and I don’t want it to direct the visiter to a second page.
Website: https://www.must.ee/uusmust/ad
<?php function my_custom_post_project() { $labels = array( 'name' => _x( 'Projects', 'post type general name' ), 'singular_name' => _x( 'Project', 'post type singular name' ), 'add_new' => _x( 'Add New', 'project' ), 'add_new_item' => __( 'Add New Project' ), 'edit_item' => __( 'Edit Project' ), 'new_item' => __( 'New Project' ), 'all_items' => __( 'All Projects' ), 'view_item' => __( 'View Project' ), 'search_items' => __( 'Search Projects' ), 'not_found' => __( 'No projects found' ), 'not_found_in_trash' => __( 'No projects found in the Trash' ), 'parent_item_colon' => '', 'menu_name' => 'Projects' ); $args = array( 'labels' => $labels, 'description' => 'Holds our projects and project specific data', 'public' => true, 'menu_position' => 5, 'supports' => array( 'title', 'excerpt'), 'has_archive' => true, ); register_post_type( 'project', $args ); } add_action( 'init', 'my_custom_post_project' ); function my_taxonomies_project() { $labels = array( 'name' => _x( 'Project Categories', 'taxonomy general name' ), 'singular_name' => _x( 'Project Category', 'taxonomy singular name' ), 'search_items' => __( 'Search Project Categories' ), 'all_items' => __( 'All Project Categories' ), 'parent_item' => __( 'Parent Project Category' ), 'parent_item_colon' => __( 'Parent Project Category:' ), 'edit_item' => __( 'Edit Project Category' ), 'update_item' => __( 'Update Project Category' ), 'add_new_item' => __( 'Add New Project Category' ), 'new_item_name' => __( 'New Project Category' ), 'menu_name' => __( 'Project Categories' ), ); $args = array( 'labels' => $labels, 'hierarchical' => true, ); register_taxonomy( 'product_category', 'project', $args ); } add_action( 'init', 'my_taxonomies_project', 0 );
Viewing 11 replies - 1 through 11 (of 11 total)
Viewing 11 replies - 1 through 11 (of 11 total)
- The topic ‘Custom post type and displaying it on your main page.’ is closed to new replies.