Have your say in Community Polls: What was/is your greatest motivation to start your own business?

Button in multicolumn

Button in multicolumn

levipront
New Member
15 0 0

Hello there,
I have quick add buttons at my homepage in my featured collection. Now, i also want these buttons in each column of my multicolumn section on my other page. Not quick add buttons but just normal buttons which will lead to another page. I tried to find the solution and got to a button by coding, but couldn't figure out how to customize this button so its the same as the others, and how to add a link to it. Can you help me out?

Scherm­afbeelding 2024-11-28 om 19.14.30.pngScherm­afbeelding 2024-11-28 om 19.14.52.png

Replies 10 (10)

Olllie
Shopify Partner
100 9 18

Hi, could you share the code you’re currently using for your custom buttons? Also, could you provide a link to your site? I’d be happy to take a look.

Ollie | Founder & Developer of autoBlogger

autoBlogger: Seamlessly scheduled, fully automated, AI-powered, and SEO-optimised blogging with a host of free extras! Start your 14-day free trial today!



Discover more at autoBlogger.bot!

levipront
New Member
15 0 0

I tried to use this code in the multicolumn.liquid code:

{% if block.settings.title_button != "Hide" %}
<a {% if block.settings.url_button != blank %} href="{{ block.settings.url_button }}"{% endif %} class="button button--primary" role="link">
{{block.settings.title_button}}
</a>

and also this in the same code but in the schema:

{
          "type": "text",
          "id": "title_button",
          "default": "Test",
          "label": "Button Text"
        },
 		{
          "type": "url",
          "id": "url_button",
          "default": "/",
          "label": "Button Link"
        }

 But this made all the buttons black with a white text. I think it has something to do with the class? But i dont know how to do that and where i can find this.
The is the preview link:

https://www.madamecharlie.nl/?_ab=0&_fd= 0&_sc=1 

I want the buttons in the columns at 'our pastries'

levipront
New Member
15 0 0

but now i can not get this to work either, i think i am messing up the place of the code

levipront
New Member
15 0 0

I think it has something to do with the 'outline' option of the buttons. I just saw if i dont have this checked, all the buttons on my site will look black/white, and if i do have it checked it will look like how i want them to. But when i did got the code to work a few days ago the option for this checkbox did not show.

levipront
New Member
15 0 0

Jup thats the case, i just checked with my other buttons. So now i just need the buttons to show and to have that option to get them outlined!

Olllie
Shopify Partner
100 9 18

Hey

 

Give this a go:

{% if block.settings.title_button != "Hide" %}
  <a 
    {% if block.settings.url_button != blank %} 
      href="{{ block.settings.url_button }}" 
    {% endif %} 
    class="button button--secondary" 
    role="link">
    {{ block.settings.title_button }}
  </a>
{% endif %}

 

(Changing button--primary to button--secondary)

 

Let me know if you are still having problems, and we can troubleshoot further.  

Ollie | Founder & Developer of autoBlogger

autoBlogger: Seamlessly scheduled, fully automated, AI-powered, and SEO-optimised blogging with a host of free extras! Start your 14-day free trial today!



Discover more at autoBlogger.bot!

levipront
New Member
15 0 0

so only this code? and where do i put this? multicolumn.liquid code?

levipront
New Member
15 0 0

It works! thanks! Just the following thing, now all of my multicolumns have a button... Can i hide the button for certain multicolumns? For all of these...
Scherm­afbeelding 2024-11-30 om 12.25.31.png

levipront
New Member
15 0 0

I got the buttons to hide but the columns are not square anymore. Like the buttons are still there but not showing (thats what i want but i also want the columns to be square. Scherm­afbeelding 2024-11-30 om 12.44.03.png

levipront
New Member
15 0 0

Mr Ollie?