• Resolved grapevyne

    (@grapevyne)


    It’s a dev site so I’m just using Local – live link. user: reading pw: graceful

    The last block on the page… Trying to create php templates instead, even the most basic, I can’t get an image to display. I’ve disabled all 3 plugins and switched to a default theme. Same issue. I even went to the documentation page and pulled an exact snippet to test because I’m not sure what else to do. If I use html in the template editor, it works fine pulling the images using {{}}. I also cleared the css to make sure nothing I added effected it. Ideas? This is what I get and the example code is below.

    <div class="genesis-custom-block <?php block_field('className'); ?>">
        <img src="<?php block_field('profile-picture'); ?>" alt="<?php block_field('author-name'); ?>" />
        <h3><?php block_field('author-name'); ?></h3>
        <p><?php block_field('testimonial'); ?></p>
    </div>
    

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Contributor Ryan Kienstra

    (@ryankienstra)

    Hi @grapevyne,

    Thanks for letting me know about this.

    Could you please put this at the top of the template for debugging, and delete it right after:

    <?php echo block_value('profile-picture'); ?>

    If it echoes something, then at least it’s finding an image, and maybe it’s just not finding the ‘full’ size of the image.

    If it echoes nothing, then it’s not finding the image at all.

    So either there’s a problem in the back-end, or there’s no image selected for the block.

    • This reply was modified 8 months, 2 weeks ago by Ryan Kienstra.
    Plugin Contributor Ryan Kienstra

    (@ryankienstra)

    PS. Great to see you’re using Local!

    Thread Starter grapevyne

    (@grapevyne)

    Thanks @ryankienstra.

    I pushed the site to a staging site so you can see. I also added the code to the template. Same thing. I’m so confused. I’ve switched to a default Twenty Twenty-Four theme as well to test and same issue.

    https://shamrockcomstg.wpenginepowered.com/careers/

    • This reply was modified 8 months, 2 weeks ago by grapevyne.
    Plugin Contributor Ryan Kienstra

    (@ryankienstra)

    Hi @grapevyne,

    Thanks, so from your staging link, this isn’t echoing anything, right?

    <?php echo block_value('profile-picture'); ?>
    Thread Starter grapevyne

    (@grapevyne)

    @ryankienstra

    Right. I can select an image and put copy into the text fields on the backend, but on the front end, no image.

    Plugin Contributor Ryan Kienstra

    (@ryankienstra)

    Hi @grapevyne,

    Thanks, could you please run this in the JavaScript console of the block editor for that page?

    wp.data.select('core/block-editor').getBlocks()

    …and paste the result here?

    That’ll show if the block has the image in its data.

    • This reply was modified 8 months, 2 weeks ago by Ryan Kienstra.
    Thread Starter grapevyne

    (@grapevyne)

    ok. Here ya go. @ryankienstra

    [
        {
            "clientId": "c3b2e02e-cb17-4b3d-9c14-c749efe32754",
            "name": "genesis-custom-blocks/testimonial",
            "isValid": true,
            "originalContent": "",
            "validationIssues": [],
            "attributes": {
                "author-name": "chris",
                "testimonial": "test",
                "profilepicture": 129
            },
            "innerBlocks": []
        }
    ]
    Plugin Contributor Ryan Kienstra

    (@ryankienstra)

    Hi @grapevyne,

    Thanks, does this echo anything?

    <?php echo block_value('profilepicture'); ?>

    The name is 'profilepicture', without a dash, it looks like.

    • This reply was modified 8 months, 2 weeks ago by Ryan Kienstra.
    Thread Starter grapevyne

    (@grapevyne)

    yep. I saw it when right when I posted. thanks @ryankienstra! lol I looked at the php template and css a million times, didn’t double check the slug on the site editor. I am getting old.

    Plugin Contributor Ryan Kienstra

    (@ryankienstra)

    All good, I’ve done that!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Images aren’t displaying’ is closed to new replies.