0

I've been trying to add more blocks to my theme's existing header block but I just can't get it to work.

Below is code from my layout file in a module that I have created. As you can see, it is very simple and I'm trying to feed in a test template at the moment, just to try and get something to work.

<referenceBlock name="porto_header">
    <block class="Smartwave\Porto\Block\Template" name="dentons.number" template="Smartwave_Dentons::test.phtml" />
</referenceBlock>

The block I am referencing is called porto_header which is the name of the header block the theme is using.

I know that the template and block is correct because I have tried referencing the header.links block and the template content was successfully added.

However when I try to add this block to the porto_header block, it just doesn't seem to work. I have added screenshots of me targeting the block to prove that it can be done. I have also added a dependancy as well to the Smartwave_Porto module but it doesn't seem to of made a difference. I have spent many hours on this to no avail. What is going on here?

I have tried asking theme support, but they have told me that this is outside of their support package. I'm not asking anyone to code anything for me, I just want to know why I can't target this block.

- Screenshot 1 - Dependency added

enter image description here

- Screenshot 2 - Custom block showing when added to header.links

enter image description here

- Screenshot 3 - Removal of header block to show that I can target the name from the module

enter image description here

- Screenshot 4 - Header gone after removal in the xml file

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.