Quantcast
Channel: WordPress.org Forums » All Posts
Viewing all articles
Browse latest Browse all 134762

mmetsalu on "Custom post type and displaying it on your main page."

$
0
0

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: http://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 all articles
Browse latest Browse all 134762

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>