I am using this code
/*
==========================================
Add category below de title
==========================================
*/
add_filter('generate_after_entry_title', function ($author) {
echo $author;
$category = get_the_category();
$cat_name = esc_html($category[0]->name);
$city = get_field('city', $post->ID);
$date = get_the_date('j F, Y');
if ($category) {
echo '<span class="date">' . $date . '</span> | ';
if ($cat_name === 'Events') {
echo '<span class="country">' . $city . '</span> | ';
}
echo '<span class="categoriess">' . $cat_name . '</span>';
}
});
When acf is not installed, inside the posts the content is not displayed. I can see the title only, why?
If I delete $city = get_field('city', $post->ID);
the content is displayed again.
because this
$city = get_field('city', $post->ID);
is causing a fatal error call of an undefined function. Without ACF installed this function does not exist.