Support

Account

Home Forums Gutenberg get 'array' instead of 'category value' in gutenberg block

Unread

get 'array' instead of 'category value' in gutenberg block

  • Hi,

    I’ve made a gutenberg block for a custom header. I can’t get the category value to populate. I’m getting ‘array’ instead of the category value. What am I doing wrong?

    $term = get_field(‘category_name’);
    $title = get_field(‘post_title’);
    $sub_title = get_field(‘sub_title’) ?: ‘Sub title here..’;
    $image = get_field(‘background_image’);
    $text_color = get_field(‘text_color’);

    ?>
    <div id=”<?php echo esc_attr($id); ?>” class=”<?php echo esc_attr($className); ?>”>

    <h6 class=”hero-category_name”><?php echo $term; ?></h6>
    <h1 class=”hero-post_title”><?php echo get_the_title($title); ?></h1>
    <p class=”hero-sub_title”><?php echo $sub_title; ?></p>

    <style type=”text/css”>
    #<?php echo $id; ?> {

    color: <?php echo $text_color; ?>;
    }
    </style>

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.