![]() |
|
||||||
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
I have set up a Custom Post Type using the Custom Post Type UI plugin. What I wanted to do was have a page called domain.com/work - this page would use the template below to display all recent "work". And have the URL for each post look like domain.com/work/custom-post There seems to be a problem with having a page called 'work' (domain.com/work), and a CPT called work. Here is what I have setup in the plugin: Post Type Name - works Label - Work Singular Label - work Public - true Show UI - true Has Archive - True Capability Type - post Hierarchical - false Rewrite - True Custom Rewrite Slug - work Query Var - true Show in Menu - True And here is the code that they give you to use - if you like: Code:
register_post_type('works', array( 'label' => 'Work','description' => 'Portfolio of design work','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'work'),'query_var' => true,'has_archive' => true,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'labels' => array (
'name' => 'Work',
'singular_name' => 'work',
'menu_name' => 'My Portfolio',
'add_new' => 'Add New',
'add_new_item' => 'Add New Project',
'edit' => 'Edit',
'edit_item' => 'Edit Project',
'new_item' => 'New Project',
'view' => 'View Project',
'view_item' => 'View Project',
'search_items' => 'Search Portfolio',
'not_found' => 'No Project Found',
'not_found_in_trash' => 'No Project found in Trash',
'parent' => 'Parent Portfolio',
),) );
Code:
<?php
/**
* Template Name: Work Gallery
*/
get_header(); ?>
<!-- start sliding boxes -->
<div class="portfolio-gallery">
<?php $recent = new WP_Query(array('post_type'=>'works', 'showposts' => genesis_get_option('slider_num'))); while($recent->have_posts()) : $recent->the_post();?>
<div class="polaroid-bg">
<div class="boxgrid slidedown">
<a href="<?php the_permalink() ?>" rel="bookmark"><?php genesis_image(array('format' => 'html', 'size' => 'Portfolio Thumbnail', 'attr' => array('class' => 'cover'))); ?></a>
<h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php $title = the_title('','',FALSE); echo substr($title, 0, 20); ?></a></h3>
<!-- comment this line out remove the author -->
<p>by <?php the_author(); ?></p>
<!-- uncomment this line to use an excerpt instead -->
<!--?php the_content_limit('30',' more »'); ?-->
</div>
</div>
<?php endwhile; ?>
</div>
<?php previous_posts_link();
next_posts_link(); ?>
<?php get_footer(); ?>
Is this possible, or am I missing something? Any help in the right direction would be appreciated. |
| Thread Tools | |
| Display Modes | |
|
|
© Copyright 2012 Copyblogger Media LLC · StudioPress™ is a trademark of Copyblogger Media LLC
Privacy Policy | Refund Policy | Terms of Service | Affiliate Program | Contact Us