• Resolved Wes Modes

    (@wmodes)


    I have CPTs render with a custom template that get included with Insert Pages in a post post-type.

    Is there a way from inside the CPT template to get the post_id of the outer post?

    • This topic was modified 4 years, 6 months ago by Wes Modes.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Paul Ryan

    (@figureone)

    You should be able to accomplish this one without anything custom, just call get_the_ID() in your custom template before you start the new loop for the inserted page. The context at the start of the custom template is still the parent post; your <?php while ( have_posts() ) : the_post(); ?> is what changes it to the inserted one.

Viewing 1 replies (of 1 total)
  • The topic ‘Get post_id of outer post’ is closed to new replies.