KeanuKeen
11/22/2017 - 4:18 PM

Wordpress Theme Essentials


//Refer to Wordpress 101 - Part 18: How to create Custom Post type - Part 1
<? php function awesome_custom_post_type (){
	
	$labels = array(
		'name' => 'Portfolio',
		'singular_name' => 'Portfolio',
		'add_new' => 'Add Item',
		'all_items' => 'All Items',
		'add_new_item' => 'Add Item',
		'edit_item' => 'Edit Item',
		'new_item' => 'New Item',
		'view_item' => 'View Item',
		'search_item' => 'Search Portfolio',
		'not_found' => 'No items found',
		'not_found_in_trash' => 'No items found in trash',
		'parent_item_colon' => 'Parent Item'
	);
	$args = array(
		'labels' => $labels,
		'public' => true,
		'has_archive' => true,
		'publicly_queryable' => true,
		'query_var' => true,
		'rewrite' => true,
		'capability_type' => 'post',
		'hierarchical' => false,
		'supports' => array(
			'title',
			'editor',
			'excerpt',
			'thumbnail',
			'revisions',
		),
		'taxonomies' => array('category', 'post_tag'),
		'menu_position' => 5,
		'exclude_from_search' => false
	);
	register_post_type('portfolio',$args);
}
add_action('init','awesome_custom_post_type');

?>
<? php

get_header();

// query_posts('post_type=post');
if( have_posts() ):
  while( have_posts() ): the_posts();
    the_title();
    the_time();
    the_category();
    the_content();
    next_posts_link();
		previous_post_link();
		the_author();
		the_content();
		the_excerpt();
		the_ID();
		the_meta();
		the_shortlink();
		the_tags();
  endwhile;
  else:
    _e( 'Sorry, no posts matched your criteria.', 'textdomain' );
endif;
<?php 


require inc/function.ph