Title: Custom Post Type Parent
Last modified: August 19, 2016

---

# Custom Post Type Parent

 *  [pikemurdy](https://wordpress.org/support/users/pikemurdy/)
 * (@pikemurdy)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-parent/)
 * I am having an issue with the “Current States” and “Parent Pages” on a custom
   post type.
 * Here is my setup:
 * I have created a custom post type (Called Radiologist). Hierarchical is set to“
   true”. Capability Type is “post”.
 * In the “Reading Settings”, my “Front Page” is set to be a static page called “
   Home”. My “Posts” (the blog) page is set to show on a static page called “News”.
 * I have a third static Page called “Physicians”. When a visitor clicks on “Physicians”,
   they will see a list of all the radiologists (the radiologists being all the 
   pages created with the new Custom Post Type).
 * When a visitor clicks on a Radiologist’s name, they go that Custom Post Type.
 * Here is the issue: WordPress seems to think that The Radiologist’s Parent Page
   is “News” (the blog page), when I want it to be “Physicians”. So the navigation
   is not showing “current_page_parent” on the wrong
    `<li>`.

Viewing 15 replies - 1 through 15 (of 29 total)

1 [2](https://wordpress.org/support/topic/custom-post-type-parent/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/custom-post-type-parent/page/2/?output_format=md)

 *  [pasiphilo](https://wordpress.org/support/users/pasiphilo/)
 * (@pasiphilo)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563466)
 * I’m having the same issue. In my scenario, I have a “Speakers” page (just a regular“
   Page” post type) using a custom template that lists out all items of my custom“
   Speaker” post type. Clicking on a “Speaker” in this list brings you to that individual“
   Speaker” post. This is all working, however, my custom post type “Speaker” seems
   to automatically be made a child of my blog page (in this case, entitled “News”)
   instead of my “Speakers” page.
 * _**Is there a way to force a specific page to be the “parent” of a specific post
   type?**_
 * **pikemurdy**, one possible work-around for you could be to manually add those
   Radiologists as children of your Physicians page in a custom menu in the Appearance
   > Menus screen. Doing this does seem to properly mark the parent of the post 
   type based on its position in the custom navigation. This isn’t ideal, however,
   because, at least in my case, I don’t want to have to manually add each “Speaker”
   to a custom navigation.
 *  [Ciprian Tepes](https://wordpress.org/support/users/cippoo/)
 * (@cippoo)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563473)
 * [@pasiphilo](https://wordpress.org/support/users/pasiphilo/) I did that but it
   added one more page_parent to the blog and on to my custom post. Weird
 *  [lorpag](https://wordpress.org/support/users/lorpag/)
 * (@lorpag)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563475)
 * I have the same issue !!
    Nobody has a solution?
 * My Scenario:
    I have “product” as custom_post_type, a Page called “products” 
   that use a custom template. When i go to the single-product page my menu add 
   a css class “current_page_parent” to the blog page but i would have the same 
   class only on “products page” list element.
 *  [petebarr](https://wordpress.org/support/users/petebarr/)
 * (@petebarr)
 * [15 years, 10 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563504)
 * I have the same issue and I’m pulling my hair out!
 * Can anybody help?
 *  [mindthemedia](https://wordpress.org/support/users/mindthemedia/)
 * (@mindthemedia)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563527)
 * Me Too, same problem… Help! Anybody?
 *  [fcalloni](https://wordpress.org/support/users/fcalloni/)
 * (@fcalloni)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563529)
 * I too have the same problem and couldn’t find anything to help.
 * As a dirty, temporary solution (hope someone finds one!) I’ve used javascript
   and jQuery to change the selected menu item, hope it helps 😉
 *     ```
       <!-- Dirty hack to change current menu item (current_page_parent) -->
       <script type="text/javascript" language="javascript">
       $(document).ready( function (){
   
       	// change this with the menu ID which SHOULDN'T be selected.
       	var temp = $('#menu-item-34').attr('class');
   
       	// removes 'current_page_parent' class from current selected menu item.
       	temp = temp.replace("current_page_parent ", "");
       	$('#menu-item-34').attr('class', temp);
   
       	// change this with the menu ID which SHOULD be selected.
       	temp = $('#menu-item-43').attr('class');
   
       	// adds 'current_page_parent' class to desired menu item.
       	temp = "current_page_parent " + temp;
       	$('#menu-item-43').attr('class',temp);
   
       });
       </script>
       ```
   
 *  [Scope](https://wordpress.org/support/users/scope/)
 * (@scope)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563533)
 * ive run into the same issue, really is odd… doesnt this defeat the purpose entirely
   of touting it as a “cms like” capability?
 * I started by creating a custom post type called “Team”…and a regular page called“
   our team” wich acts as an index page… just a page template pulling in the custom“
   Team” pages.
 * in my case my custom post type is set to “page”… i set the ‘supports’ argument
   when registering the custom post type to include ‘page-attributes’ thinking this
   would let me bring in the _default_ parent drop down… wich would open up the 
   existing ‘pages’ to set one of them as the parent.
 * With the idea being that i could select the static “our team” page to be the 
   parent. thereby integrating it all menu-wise.
 * but even though the page attributes box does appear in the custom write panel,
   the ‘Parent’ drop down menu only shows pages of this particular custom type (
   team pages) wich is unfortunate, and doesnt make sense to me as these pages are
   essentially siblings.
 * i had assumed this is what would have let us set ANY existing page as ‘parent’…
   as it is, there doesnt seem to be a way to have a proper “top level” page for
   custom pages.
 * (on another note, the page template dropdown is missing entirely as well, wich
   was another surprise. it seems that the despite the term ‘capability_type’ A 
   custom “page” type cannot use page template?
 * these custom post types dont quite actually do what posts/pages are capable of.
 * *******************
 * I was thinking of creating an “our team” top level page as a custom post type
   and setting it as the parent of the other team pages (since now it would appear
   as an option) and then running a conditional statement in the custom single post
   template… and adding in the appropriate code that way (single post code if its
   a child, get all posts code if its a parent)
 * But that would cause the same issue cippo mentioned above… double “parent” labels
   in the url. it could probably still work out with creative labeling, but it still
   means custom post types would always be 3 levels deep.
 * ….good god i rambled
 *  [Naoise Golden Santos](https://wordpress.org/support/users/ngolden/)
 * (@ngolden)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563537)
 * same problem here!
 * trying to create a single-custom-post-type-name.php but the **menu item with 
   current_page_item class** is the Blog page item instead of the custom page with“
   Custom Post Type Name” Template!
 * Having huge problems creating child themes with Thematic and Custom Post Type…
   it makes me want to work with pages instead of custom post types
 *  [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563538)
 * This annoying me as well. It basically renders the whole current_parent_item 
   class naming pointless, since if you use posts the only parent you ever have 
   is blog.
 * The only was I can think of to get around it is creating a series of child pages
   and custom page templates like so:
 * Parent:Work Page: Shows all custom type work posts.
    child:Single work page: 
   Shows single work post. child:Single work cat page: If you have some categories
   for work posts. chuld:Single work archive page: Archive of work posts.
 * I think, in theory, the current_page_item WOULD be ‘Work page’ for all the child
   pages, even though they are showings posts. The annoying this about this is that
   you have to make loads of pages and different templates. I’ll test it out and
   let you know if it works.
 *  [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563539)
 * No wait, that wouldn’t work because when you view a single post it always uses
   single.php or a variation of it. No way of displaying single posts through a 
   page template as far as I’m aware.
 * There must be some way of hacking this.
 *  [syrus69](https://wordpress.org/support/users/syrus69/)
 * (@syrus69)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563540)
 * i am having a similar problem with my CPT aswell,
    but my issue is that how do
   i separate the normal blog posts and CPT i have hunted the net for solutions 
   but can not find any
 *  [beetrootman](https://wordpress.org/support/users/beetrootman/)
 * (@beetrootman)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563541)
 * different issue entirely. I will PM you some info.
 *  [fcalloni](https://wordpress.org/support/users/fcalloni/)
 * (@fcalloni)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563542)
 * > i am having a similar problem with my CPT aswell,
   >  but my issue is that how
   > do i separate the normal blog posts and CPT i have hunted the net for solutions
   > but can not find any
 * hi syrus69, to show only your custom posts create a page (i.e. page-artwork.php
   my case) and set your own WP_Query – have a code like this on the page:
 *     ```
       <?php
       $type = 'sf1_artist';
       $args=array(
         'post_type' => $type,
         'post_status' => 'publish',
         'paged' => $paged,
         'posts_per_page' => 4,
         'caller_get_posts'=> 1
       );
       $temp = $wp_query;  // assign orginal query to temp variable for later use
       $wp_query = null;
       $wp_query = new WP_Query($args); 
   
       get_template_part( 'loop', 'artists' );
       ?>
       ```
   
 * for more info check these:
    [http://codex.wordpress.org/Function_Reference/WP_Query](http://codex.wordpress.org/Function_Reference/WP_Query)
   [http://codex.wordpress.org/The_Loop](http://codex.wordpress.org/The_Loop)
 *  [syrus69](https://wordpress.org/support/users/syrus69/)
 * (@syrus69)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563543)
 * cheers mate will look into it
 *  [miradev](https://wordpress.org/support/users/miradev/)
 * (@miradev)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/custom-post-type-parent/#post-1563562)
 * I think this is a fairly generic and common requirement that CPT has really highlighted.
   The concept of post-type-hierarchy would solve most of these problems.
 * In the classic ‘music collection’ example, you would have a CPT of ‘Album’ that
   had child CPT of ‘Track’. Adding new ‘Track’ posts would require the assignation
   of a parent ‘Album’ post.

Viewing 15 replies - 1 through 15 (of 29 total)

1 [2](https://wordpress.org/support/topic/custom-post-type-parent/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/custom-post-type-parent/page/2/?output_format=md)

The topic ‘Custom Post Type Parent’ is closed to new replies.

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)
 * [hierarchical](https://wordpress.org/support/topic-tag/hierarchical/)

 * 29 replies
 * 25 participants
 * Last reply from: [Dan Couper](https://wordpress.org/support/users/dan-couper/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/custom-post-type-parent/page/2/#post-1563601)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
