Our error log is pointing out
PHP Notice: Undefined variable: _post in /var/www/html/wordpress/wp-content/themes/grady/template-parts/degree-faculty.php on line 52 (that’s the line with $post_thumb = get_the_post_thumbnail_url( $_post->ID, 'full' );
<?php
$i = 1;
foreach($posts as $post):
?>
<?php if($i%4 == 1) echo '<div class="grid">'; ?>
<div class="grid__item col-1-1 s--col-1-2 l--col-1-4">
<div class="faculty-block">
<a href="<?php echo get_permalink(); ?>">
<?php
$post_thumb = get_the_post_thumbnail_url( $_post->ID, 'full' );
if($post_thumb):
echo '<img src="'.$post_thumb.'" alt="'.get_the_title().'" class="faculty-block_image"/>';
else:
echo '<img src="'.get_stylesheet_directory_uri().'/assets/img/headshot_bulldog.jpg" alt="'.get_field('first_name').'" class="faculty-block_image"/>';
endif;
$firstname = get_field('first_name').' ';
$lastname = get_the_title();
$fullname = $firstname.' '.$lastname;
$title = get_field('faculty_title');
$departments = get_field('primary_dept');
?>
<span class="faculty-block_content vertical_center">
<span class="faculty-block_name"><?php echo $fullname; ?></span>
<span class="faculty-block_title"><?php echo $title; ?></span>
<span class="faculty-block_department"><?php echo $departments; ?></span>
</span>
</a>
</div>
</div>
<?php if($i%4 == 0) echo '</div>'; ?>
<?php
$i++;
endforeach;
if($count%4 != 1) echo "</div>";
wp_reset_postdata();
?>
</div>
</div>
<?php endif; ?>
Another error with similar message
Notice: Undefined variable: post_id in /var/www/html/wordpress/wp-content/themes/grady/single.php on line 38
post_ID seems to be causing errors, is this related to ACF?
Hi,
Sorry to hear you ran into issues with the update. We haven’t had any similar reports of the $post_id getting messed up, so it’d be good to get to the bottom of this.
Regarding the first notice, I can’t really see how that would interfere with the layout, since as far as I can tell the $_post variable is just being being used to grab the image for the faculty members.
Have you tried temporarily reverting back to 5.10.2 (preferably on a dev/staging site) to see if that resolves the layout issue? Was anything else updated at the same time as ACF?
Thanks for being here!
Yes, ACF was the only plugin we’ve had update.
I don’t have access to a dev site, so I can’t roll back to a previous version of ACF as a test.
I will keep checking back to see if anyone else has similar issues, thanks again for your attention.
-d
This issue can be put to rest, it was not ACF at all.
We’ve had success deactivating the plugin which updated just before yours, thank you for your patience while we investigated. You may feel free to remove this post altogether — sorry and thank you again!
-don