Creating a button in Kirby

Hi,

Creating a button in Kirby… I just can’t seem to work it out.

What are the easiest ways?

a. What Blueprint field(s) is best practice so it’s easy for myself and/or clients.
b. How to set up the PHP.

Examples:

  1. The URL: https://getkirby.com/. The text: getkirby.com
  2. The URL: https://getkirby.com/. The text: Get Kirby

I’m probably going to kick myself but, I cant seem to figure it out and there’s not much info in the forum.

Thanks in advance!

There are multiple ways, and it depends on where the button is going to be used. Your button examply is not really a button but a link, styled as button.

  • in a textarea field: use a link kirbytag and style as button on the frontend if really necessary: (link: …) | Kirby CMS
  • in a blocks/layout field: create a custom button block: Blocks | Kirby CMS
  • a structure field with a single item with one field for text and on for the link can be use for a stand-alone button
  • The link field plugins provides another way for a stand-alone button: Link Field | Kirby CMS
  • If you want to link to a page, a pages field could be used to select the page to link to (url and text would come from the selected page)

Brilliant! This is really helpful! I think I’ll go with the Blocks for now but the Link Field plugin seems really interesting.

Thanks for your help.