PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, July 1, 2022

[FIXED] How to add custom html block to list of footer options?

 July 01, 2022     liquid, shopify, shopify-template     No comments   

Issue

I am using the Debut theme on Shopify and wanting to customize my footer (my site)

There are options within the customize theme to add and remove the column sections of the footer, however there is no option to add a custom html block as one of the columns. How can I add Custom HTML to this list of options for footer columns?:

current footer options

Thanks for your help!


Solution

Open /sections/footer.liquid then add a new section block to the blocks array, this code should give you a basic starting point:

{
  "type": "html_content",
  "name": "HTML Content",
  "settings": [
    {
      "type": "html",
      "id": "html_area",
      "label": "Custom HTML",
      "default": "<div><p>Some HTML content</p></div>"
    }
  ]
}

Then to display the content, you need to add a new type check for the html_content type in the {%- case block.type -%} block, like so:

{%- case block.type -%}
  {%- when 'newsletter' -%}
    .
    .
    .
  {%- when 'text' -%}
    .
    .
    .
  {%- when 'link_list' -%}
    .
    .
    .
  {%- when 'html_content' -%}
    {{ block.settings.html_area }}
{%- endcase -%}

When you save the change and refresh your theme customizer, you should be able to see a new content type in the footer section.

For all theme section input types refer to this doc.



Answered By - Karim Tarek
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing