cpt

http://codex.wordpress.org/Custom_Post_Types

http://shibashake.com/wordpress-theme/add-custom-post-type-columns

Add the below code in function.php file
Custom post type
/---------------------------------------------------/
add_action( 'init', 'create_post_type' );
function create_post_type() {
    register_post_type( 'acme_product',
        array(
            'labels' => array(
                'name' => __( 'Products' ),
                'singular_name' => __( 'Product' )
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'products'),
        )
    );
}



Display the custom post in frontend
/******************************************************/
                
                    $args = array( 'post_type' => 'acme_product', 'posts_per_page' => 10 );
                    $loop = new WP_Query( $args );
                    while ( $loop->have_posts() ) : $loop->the_post();
                    the_title();
                    echo '
'; the_content(); echo '
'; endwhile; /**** Display the texomany name ***/ ID , 'Category' ); foreach ( $terms as $term ) { echo $term->name; }?> /************************************************************/ custom post yupe with custom category add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'acme_product', array( 'labels' => array( 'name' => __( 'Products' ), 'singular_name' => __( 'Product' ), 'edit_item' => __( 'Edit Product' ) ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'products'), 'supports' => array( 'title', 'editor', 'excerpt', 'custom-fields', 'revisions', 'thumbnail' ), ) ); } function add_product_taxonomies() { register_taxonomy('size', 'acme_product', array( // Hierarchical taxonomy (like categories) 'hierarchical' => true, // This array of options controls the labels displayed in the WordPress Admin UI 'labels' => array( 'name' => _x( 'size', 'taxonomy general name' ), 'singular_name' => _x( 'size', 'taxonomy singular name' ), 'search_items' => __( 'Search Categories' ), 'all_items' => __( 'All Categories' ), 'parent_item' => __( 'Parent Categories' ), 'parent_item_colon' => __( 'Parent Categories:' ), 'edit_item' => __( 'Edit Categories' ), 'update_item' => __( 'Update Categories' ), 'add_new_item' => __( 'Add New Categories' ), 'new_item_name' => __( 'New Categories Name' ), 'menu_name' => __( 'size' ), ), // Control the slugs used for this taxonomy 'rewrite' => array( 'slug' => 'size', // This controls the base slug that will display before each term 'with_front' => false, // Don't display the category base before "/locations/" 'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/" ), )); } add_action( 'init', 'add_product_taxonomies', 0 ); *project custom post type with category************/ /* Custome Post Type */ add_action( 'init', 'project' ); function project() { register_post_type( 'project', array( 'labels' => array( 'name' => __( 'Project' ), 'singular_name' => __( 'Project' ), 'search_items' => __( 'Search Project' ), 'parent_item' => __( 'Parent Project' ), 'parent_item_colon' => __( 'Parent Project:' ), 'edit_item' => __( 'Edit Project' ), 'update_item' => __( 'Update Project' ), 'add_new_item' => __( 'Add New Project' ), 'new_item_name' => __( 'New Project Name' ), ), 'public' => true, 'has_archive' => true, 'rewrite' => array('slug' => 'project'), 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'comments' ), ) ); } /*------------------------------------------------------------------------------------------------------*/ /* Custome Taxonomy Type */ function add_project_taxonomies() { register_taxonomy('p_category', 'project', array( 'hierarchical' => true, 'labels' => array( 'name' => _x( 'Project Category', 'taxonomy general name' ), 'singular_name' => _x( 'Category', 'taxonomy singular name' ), 'search_items' => __( 'Search Categories' ), 'all_items' => __( 'All Categories' ), 'parent_item' => __( 'Parent Categories' ), 'parent_item_colon' => __( 'Parent Categories:' ), 'edit_item' => __( 'Edit Categories' ), 'update_item' => __( 'Update Categories' ), 'add_new_item' => __( 'Add New Categories' ), 'new_item_name' => __( 'New Categories Name' ), 'menu_name' => __( 'Categories' ), ), 'rewrite' => array( 'slug' => 'p_category', 'with_front' => false, 'hierarchical' => true ), )); } add_action( 'init', 'add_project_taxonomies', 0 ); /**** Display the texomany name ***/ ID , 'Category' ); foreach ( $terms as $term ) { echo $term->name; }?> /********* Change the post type after click template page*****/ Add the below conditon on which single.php file create " content-acme_services_services " template acme_services is post type name
--------------------- second way http://wordpress.stackexchange.com/questions/156036/custom-template-for-wordpress-cpt-plugin add_filter('template_include', 'testimonial_archive'); function testimonial_archive( $template ) { $post_types = array('astestimonial'); if ( is_post_type_archive( $post_types ) && locate_template('atestimonial-archive.php' ) == '' ) { $template = dirname(__FILE__) . '/list-testimonial.php'; } if ( is_singular( $post_types ) && locate_template( 'single-testimonial.php' ) == '' ) { $template = dirname(__FILE__) . '/single-testimonial.php'; } return $template; }

COMMENT PLEASE..!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Meat & Potatoes of Life

By Lisa Smith Molinari

ultimatemindsettoday

A great WordPress.com site

Spiritual Foodie

The integration of spirit and food

%d bloggers like this: