If you are using the block (Gutenberg) editor to edit a page, you will find one or more button blocks. They make it easy to add a button with a link.
But, if you need to edit a page using the classic editor, or add a button in a widget, here's how to change any link into a button by adding a CSS class.
In WordPress, go to edit the page or widget.
- First add some text, and use the link icon to add a link to the text.
- Next, switch to the Text tab in the editor.
- Add this to the link - class="button" - see gist below.
- Switch back to the Visual tab in the editor.
- Save.
If your link looks like the top line,
then add - class="button" so it looks like the second line.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
| <a href="http://www.winningagent.com/">Button Text</a> | |
| <a class="button" href="http://www.winningagent.com/">Button Text</a> |
And you will see:
Button Text