wp_get_post_parent_id example

'after'    => '</nav>',
                    /* translators: %: Page number. */
                    'pagelink' => esc_html__( 'Page %', 'twentytwentyone' ),
                )
            );
            ?> </div><!-- .entry-content --> <footer class="entry-footer default-max-width"> <?php             // Check if there is a parent, then add the published in link.             if ( wp_get_post_parent_id( $post ) ) {
                echo '<span class="posted-on">';
                printf(
                    /* translators: %s: Parent post. */
                    esc_html__( 'Published in %s', 'twentytwentyone' ),
                    '<a href="' . esc_url( get_the_permalink( wp_get_post_parent_id( $post ) ) ) . '">' . esc_html( get_the_title( wp_get_post_parent_id( $post ) ) ) . '</a>'
                );
                echo '</span>';
            } else {
                // Edit post link.                 edit_post_link(
                    sprintf(
                        
Home | Imprint | This part of the site doesn't use cookies.