I'm making an admin page for my plugin and I'd like to make a text link designed like the form button of admin pages.

I tried this but didn't work well.

<a href="" cless="button-primary" style="line-height: 2em; border-color: #298CBA; font-weight: bold; color: white; background: #21759B url(../images/button-grad.png) repeat-x scroll left top; text-shadow: rgba(0, 0, 0, 0.3) 0 -1px 0;">Submit</a>

I also tried just putting a submit button, expecting that the page goes to the url in the action attribute.

<form action="$url" target="_self">
    <input type="submit" class="button-primary" value="Submit" />

Does anybody know how?

  • 1
    The main issue is probably the misspelling of class, you have cless... – Eric Holmes Oct 3 '13 at 19:39
  • 1
    If your question has been answered, please accept the correct answer. – Ciprian Mar 23 '15 at 11:21

You can style a link as a button with the button css class:

<a href="#" class="button">I am a button</a>

You can modify a button with the primary styling by adding button-primary:

<a href="#" class="button button-primary">I am the primary button</a>

This worked,

$pageslug = 'the-plugin-option-page-slug';
    <form method="post" action="?page=<?php echo $pageslug; ?>&tab=2">
        <input type="submit" class="button-primary" value="Submit" />       

I have tabbed option pages and the button just works like a link to the tab 2 page without submitting anything.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.