Okay,
Where is teh custom post type directed to? is it single.php or page.php I have a page.php with a template part that displays each of my custom types but when i click on the item itself i just get 404'd
This is my register custom post type
$labels = array(
'name' => _x( 'podiums', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'podium', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Post Type', 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'all_items' => __( 'All Items', 'text_domain' ),
'view_item' => __( 'View Item', 'text_domain' ),
'add_new_item' => __( 'Add New Item', 'text_domain' ),
'add_new' => __( 'Add New', 'text_domain' ),
'edit_item' => __( 'Edit Item', 'text_domain' ),
'update_item' => __( 'Update Item', 'text_domain' ),
'search_items' => __( 'Search Item', 'text_domain' ),
'not_found' => __( 'Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
);
$args = array(
'label' => __( 'Podium', 'text_domain' ),
'description' => __( 'Podium Photos Taken at Nottingham Go Karts', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'thumbnail', 'custom-fields', ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => false,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'group', $args );
my page.php
<?php get_header(); ?>
<main class="container">
<div class="row">
<section id="post-<?php the_ID(); ?>" <?php post_class('podium col-md-12'); ?>>
<?php query_posts( 'post_type=group&posts_per_page=5'); ?>
<?php
// Start the loop.
while ( have_posts() ) : the_post();
get_template_part( 'content', 'podium' );
// End the loop.
endwhile;
?>
</section><!-- Article End -->
</div><!-- Row End -->
</main><!-- Section End -->
and this is my content-podium.php
<h1><?php the_title(); ?></h1>
<p>
View all past groups thats visited Nottingham Go Karts
</p>
<ul>
<li class="col-xs-6 col-sm-6 col-md-4 col-lg-3">
<a href="<?php the_permalink() ?>">
<?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID, 'post-thumbnail') ); ?>
<img src="<?php echo $url ?>" />
</a>
</li>
</ul>
Should my page.php actually be displaying the items themselves and the content-podium actually display them singularly ?
Ive googled around and im just getting more and more confused and nothing seems to be working. to see it in action its here /
Okay,
Where is teh custom post type directed to? is it single.php or page.php I have a page.php with a template part that displays each of my custom types but when i click on the item itself i just get 404'd
This is my register custom post type
$labels = array(
'name' => _x( 'podiums', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'podium', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Post Type', 'text_domain' ),
'parent_item_colon' => __( 'Parent Item:', 'text_domain' ),
'all_items' => __( 'All Items', 'text_domain' ),
'view_item' => __( 'View Item', 'text_domain' ),
'add_new_item' => __( 'Add New Item', 'text_domain' ),
'add_new' => __( 'Add New', 'text_domain' ),
'edit_item' => __( 'Edit Item', 'text_domain' ),
'update_item' => __( 'Update Item', 'text_domain' ),
'search_items' => __( 'Search Item', 'text_domain' ),
'not_found' => __( 'Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
);
$args = array(
'label' => __( 'Podium', 'text_domain' ),
'description' => __( 'Podium Photos Taken at Nottingham Go Karts', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'thumbnail', 'custom-fields', ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => false,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'group', $args );
my page.php
<?php get_header(); ?>
<main class="container">
<div class="row">
<section id="post-<?php the_ID(); ?>" <?php post_class('podium col-md-12'); ?>>
<?php query_posts( 'post_type=group&posts_per_page=5'); ?>
<?php
// Start the loop.
while ( have_posts() ) : the_post();
get_template_part( 'content', 'podium' );
// End the loop.
endwhile;
?>
</section><!-- Article End -->
</div><!-- Row End -->
</main><!-- Section End -->
and this is my content-podium.php
<h1><?php the_title(); ?></h1>
<p>
View all past groups thats visited Nottingham Go Karts
</p>
<ul>
<li class="col-xs-6 col-sm-6 col-md-4 col-lg-3">
<a href="<?php the_permalink() ?>">
<?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID, 'post-thumbnail') ); ?>
<img src="<?php echo $url ?>" />
</a>
</li>
</ul>
Should my page.php actually be displaying the items themselves and the content-podium actually display them singularly ?
Ive googled around and im just getting more and more confused and nothing seems to be working. to see it in action its here http://thomasrenshaw.com/gallery/
After registering a custom post type, you must flush the rewrite rules so Wordpress knows what the URL / slug should be.
flush_rewrite_rules()