I will try to explain my problem simply and quickly:
I used CPT UI in Wordpress to create my own type of posts - employees. Each employee has an ACF field: email, name, description. On the team of employees page, I display all people with e-mail, photo and name. Each person is in a box, which is a link to separate subpages.
Each sub-page should contain an additional description of the selected employee.
I can't create a link from the team page that will open the subpage of the person you clicked on.
On the team page ( # is the link to subpage of employee):
<?php $count = 1; ?>
<?php $loop = new WP_Query( array( 'post_type' => 'team', 'orderby' => 'post_id', 'order' => 'ASC' ) ); ?>
<?php while( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="col-lg-3 col-sm-6">
<a href="#" id="person-<?php echo $count; ?>" class="team-item">
<img src="<?php the_field('team_photo'); ?>">
<p><?php the_title(); ?></p>
<p><?php the_field('stanowisko'); ?></p>
<p><?php the_field('adres_email'); ?></p>
<p></p>
</a>
</div>
<?php $count++; ?>
<?php endwhile; ?>
Of course, the subpage is a template called page-person.php
I tried to send the post ID of the box, which is currently clicked, to page-person.php, but I do something wrong in the link design:
<a href="<?php bloginfo('stylesheet_directory'); ?>/page-person?post_id=<?php the_ID(); ?>" id="person-<?php echo $count; ?>" class="team-item">
after clicking on the box I get an error in the line: get_header (); the subpage file.
Fatal error: Uncaught Error: Call to undefined function get_header() in