[Resolved] Adding code to block element

Home Forums Support [Resolved] Adding code to block element

Home Forums Support Adding code to block element

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #1975540
    Speedy

    My usual method of creating header elements with a page hero seems to have stopped working for me with the latest release, and I have been advised to try using the block element instead.

    I’ve managed to get the block to use the featured image from a page as a background OK, but I also want to insert some code like this:

    {{custom_field.headline}}

    which allows me to vary the text shown in the block by editing a custom field in each page.

    I’ve tried inserting this as code and as html in the block element editor, but it just shows the raw code on the pages?

    #1975619
    David
    Staff
    Customer Support

    Hi there,

    you don’t use the Template Tags in Block Elements.
    Install the GenerateBlocks plugin, and then you can add a GB Headline Block and set its Dynamic Data type to Post Meta > Your Custom Field Name.

    See here for more info on Dynanic data:

    https://docs.generatepress.com/article/dynamic-data/

    And heres one of the Block Element docs for building Page Heroes:

    https://docs.generatepress.com/article/block-element-page-hero/

    #1975668
    Speedy

    OK, thanks for the extra info David. Guess I’ve been avoiding this whole “blocks” thing long enough will have to get my head around the new way of doing things, even though I’m very happy with the way things were before πŸ™‚
    Cheers

    #1975677
    David
    Staff
    Customer Support

    There should be no reason the Header Elements stopped working… if you want me to review the issue you were having there then let me know.

    If not then happy block building πŸ™‚

    #1975741
    Speedy

    Well, seeing as you offered then yes, I really would like to get to the bottom of this if poss.

    I’ve been using GP for years and am very happy with it. Recently I noticed that trying to create a new header element, the box which normally contains text etc has just disappeared from the editor. The weird thing is that if I look at some of my other sites which are running the latest version, it IS still there, so long as the header was created with a previous version of GP. If so I can still edit what’s in there. But, when I select Create new header element, it is completely missing?!

    I can even export header elements (with the content box working) from other sites, and import them into my latest site running the latest GP premium and again, everything works as expected for those imported headers?!!

    Switching to an older version of GP fixes the issue of creating new header elements for me.

    I have already tried deactivating everything but GP, rolling back my GP theme, reinstalling wordpress and even tried changing my PHP version down from 7.4 but nothing other than an older version of GP premium seems to work.

    #1975837
    David
    Staff
    Customer Support

    One thing to note – in recent update we switched the default tab order around so it shows the Site Header tab when you first open the element, and the Page Hero tab ( where the text area and settings are ) is on the second tab.

    If thats not the issue – Would you be happy to provide me with a Temporary Admin Login to the site so i can take a look?
    You can share the URL / login in the Private Information field.

    #1975867
    Speedy

    Thanks David – login below.

    This is the site where I installed a previous version GP premium, so the issue is not present.

    If you want to just update GP in the plugins section then you should see what I’m on about?!! In the elements you’ll see “HERO” which is a header I created before. I expect this to continue to work regardless of the GP version but NEW header, the content box vanishes! :O

    Thanks for taking this seriously πŸ™‚

    Cheers

    #1976224
    David
    Staff
    Customer Support

    I updated to the latest GP Premium and then did this:

    #1976247
    Speedy

    Thanks David. This is getting stranger by the minute – take a look at my screen….

    #1976277
    Speedy

    For fun I just tried the exact same with the admin I created for you and again, everything is working fine???

    Seems like wordpress has something against me. Trying not to take it personally, but… could it have anything to do with the site admin setting???

    #1976285
    Speedy

    Progress! This got me thinking. I checked my user and I usually check the ” Disable syntax highlighting when editing code ” setting as I make a lot of CSS changes. Unchecking that and the header content box is back again!!!!
    πŸ™‚

    #1976293
    David
    Staff
    Customer Support

    Phew… glad you found the issue πŸ™‚

    #1976299
    Speedy

    πŸ™‚

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.