• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Getting error when Trying to display custom block

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Genesis Custom Blocks › Getting error when Trying to display custom block

This topic is: not resolved

Tagged: Genesis Custom Blocks

  • This topic has 6 replies, 4 voices, and was last updated 1 year, 7 months ago by Jelly4567.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • March 21, 2022 at 4:55 pm #504867
    chiller
    Participant

    Hey Everyone,

    I am working on setting up a custom block with Genesis Custom Blocks. I have the block front end configured and my php build out on the backend. When I go to preview the block or add it to any page I get the following error

    Error loading block: The response is not a valid JSON response.

    I am using the following:

    Theme: Custom theme using Sage 10 Framework
    PHP: 7.4.28
    WordPress: 5.9.2

    Plugins Installed:
    - Acorn (for Sage 10)
    - Genesis Custom Blocks

    Below is a copy of my backend code

    
    <div class="hero-block">
    
        <div class="hero-block__left">
            <?php if($block_field('pre-header-text')) : ?>
                <div class="hero-block__pre-header">
                    <?php $block_field('pre-header-text'); ?>
                </div>
            <?php endif; ?>
            
            <?php if($block_field('header-text')) : ?>
                <h1 class="hero-block__header">
                    <?php $block_field('header-text'); ?>
                </h1>
            <?php endif; ?>
    
            <?php if($block_field('body-text')) : ?>
                <p class="hero-block__body">
                    <?php $block_field('body-text'); ?>
                </p>
            <?php endif; ?>
    
            <?php if($block_field('call-to-action-text')) : ?>
                <a href="<?php $block_field('call-to-action-link'); ?>" class="hero-block__cta-link">
                    <?php $block_field('call-to-action-text'); ?>
                </a>
            <?php endif; ?>
        </div>
    
        <div class="hero-block__right">
            <?php if($block_field('hero-image')) : ?>
                <img src="<?php $block_field('hero-image'); ?>" alt="<?php $block_field('hero-image-alt'); ?>" />
            <?php endif; ?>
        </div>
        
    </div>
    
    March 21, 2022 at 5:53 pm #504868
    chiller
    Participant

    Figured it out, my PHP was bad. DOH...

    May 15, 2022 at 6:43 pm #505248
    Lincoln3749
    Participant

    Yeah, You are right I am also facing some errors while using some custom blocks on genesis theme. As I have developed a script by my developer for android apps site. But when I apply it so it shows some error. Have your found the solution. Kindly share your experience if you have found solution.

    July 20, 2022 at 5:04 am #505576
    warnersmith
    Participant

    PHP Ternary Operator It Might Help You.

    December 9, 2022 at 9:43 am #506315
    Michaelmati
    Participant

    This error likely indicates that there is an issue in the php build out for the custom block. It is possible that the JSON response is not formed correctly or that there is an issue in the way the data is being retrieved from the database. If the JSON response is valid, then it may be possible that there is an issue with the way the data is being passed from the back end to the front end. It is best to debug the code line by line to determine the source of the error and make any necessary corrections.

    I am facing this error on my website dentclub.co.uk and now ill fix by applying this.

    July 16, 2023 at 5:44 am #507553
    Jelly4567
    Blocked

    If you're encountering an error when trying to display a custom block, there could be several potential causes. Without specific details about the error message or the context in which you are working, it's difficult to provide a precise solution. However, here are a few general troubleshooting steps you can try:

    Check for syntax errors: Make sure that the custom block's code doesn't contain any syntax errors or typos. Even a small mistake like a missing bracket or semicolon can cause errors by video-star a comprehensive comparison. Carefully review the code to ensure it is correctly written.

    Verify block existence: Double-check that the custom block is defined and registered properly. Ensure that the block's name, handle, and registration function match correctly. If the block is not registered correctly, it won't be available for display.

    Examine dependencies: If your custom block relies on external dependencies or libraries, ensure that they are properly included and loaded. Make sure that all necessary files are accessible and that any dependencies are correctly installed or imported.

    September 27, 2023 at 10:58 am #507669
    Jelly4567
    Blocked

    !
    If you're encountering an error when trying to display a custom block, there could be several reasons for this issue. The specific steps to troubleshoot and resolve the error depend on the context of your development environment, the platform or framework you're using, and the nature of the error. Here are some general steps you can take to identify and fix the problem Safepowering.com:

    1. Check Error Messages:
    Look at the error messages you're receiving. The error message can often provide valuable information about what went wrong. Check your server logs, console logs, or any error messages displayed on the page.

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
Log In

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble