I have a template page in WordPress that I want the Admin to be able to change the text on that page. I’d love to learn how to make a plugin (I know how to make a plugin so that it shows up in WP, installs when the user sets it to activate, and then create the admin panel) that shows just one text field, and the data the person enters is passed to the template page.
If I could have help finding a tutorial or simple advice on how to do this, it would be greatly appreciated.
An example code for an options-page for a theme. Copy this code in the functions.php of the theme.
this is my options from this code:
I hope you understand the code, is also an dummy, works, but is not so fine in the php-codex for classes.
Here is my way:
This is just a short adaptation from the theme settings I implemented in my theme, which is much more complex than this.
Note that hidden input with 0 value – this is a trick to force the form to send
$_POST['my_checkbox']
even if the field is unchecked.Why do you want special admin panel for this? It seems like something that can simply be handled by page with custom template if necessary.
You can also load content of non-public page by code and use it where you need it.
See Pages in Codex.