StudioPress Community Forums
  StudioPress Community Forums > Forums > General Discussion
For help and support, access to your downloads, or to manage your account please log into My StudioPress.

These forums have been set to read-only so you can browse the existing topics for any questions you may have.

For general discussion on WordPress, CSS and design (NOT for support) visit the new Community Forums.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-17-2011, 08:12 AM
jaywills jaywills is offline
Registered User
Genesis Member
Pro Plus Member
 
Join Date: May 2010
Posts: 115
Default Custom Post Type URL Issue

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',
),) );
I then have this template with a WP Query that calls for the 'post_type'=>'works'

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 &raquo'); ?-->
			</div>
		</div>
	<?php endwhile; ?>
</div>
<?php previous_posts_link(); 
		next_posts_link(); ?>
<?php get_footer(); ?>
I can get this to work properly if I create a page called "portfolio", and use the template. But not when I have a page called "work" and use the template.

Is this possible, or am I missing something? Any help in the right direction would be appreciated.
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 08:09 AM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.