Support

Account

Home Forums Front-end Issues Post content disappear

Helping

Post content disappear

  • 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.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.