Monday, 15 February 2010

Display custom post types in grid Wordpress -



Display custom post types in grid Wordpress -

i trying display custom post type (cpt) in grid view similar on site:

www.virtualpudding.com

i have thoroughly searched google , stackoverflow no avail. needs have thumbnail site linked above when clicked follows through specific page. portfolio show case work.

currently have custom post type entitled 'portfolio' , have created basic template display these using next code;

<?php /** * template name: recipes page * * selectable dropdown menu on edit page screen. */ get_header(); ?> <div id="primary"> <div id="content" role="main"> <?php query_posts( 'post_type=portfolio'); ?> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part( 'content', 'page' ); ?> <?php comments_template( '', true ); ?> <?php endwhile; // end of loop. ?> </div><!-- #content --> </div><!-- #primary --> <?php get_footer(); ?>

i not php coder , have little knowledge of php coding , help much appreciated.

thanks

first of create sure custom post type supports 'thumbnails'.

the wordpress function "register_post_type" takes array can configure custom post type. 1 of array element "supports" allows specify features custom post type has.'

register_post_type

or add_post_type_support

then, in while loop, can thumbnail using has_post_thumbnail , the_post_thumbnail

wordpress wordpress-theming custom-post-type

No comments:

Post a Comment