Support » Fixing WordPress » Setting a Parent Page for a Custom Post Type

  • Is there a way to set a static parent page for a custom post type single page?

    In other words… I have a custom post type called “Press Releases” and I would like to say that its parent is “News,” which is a static page.

    Maybe there is some way to utilize the “$post->post_parent;” code to name the parent for an item such as a custom post type. I know this is crude and will not work but some form of manipulation like this… “pressreleases->post_parent = news;”

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You mean you want a page similar to blog page for your custom post type Press Releases and when you post anything it goes on the News page.

    Yes, I believe that is pretty accurate. I currently have a custom loop on my “News” page template that achieves that, but the child pages (single) do not register as children of “News”.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    My main motive was to utilize this code to work with breadcrumbs and in the sidebars.

    Basically, how can I get my custom post type single page (press releases) to register as child pages of “news”?

    I figured by using a variation of the $post->post_parent code that I can trick the breadcrumbs into thinking the parent for the “press releases” is “news”.

    You can create a template for your custom post type using index.php code and then make the change in template to query your custom post type

    I have a article on my website on how to use custom post type see this helps

    I do not believe that is what I am looking for. I am able to pull in the custom post types but I can not register the single pages as having a different parent.

    Did you figure this out? I am trying to achieve the same thing with no luck. i think im just going to have to forgo custom post types for now. =/

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Setting a Parent Page for a Custom Post Type’ is closed to new replies.