Ready to get started?Download WordPress


How to Remember the Checked Options in Custom Admin Panel? (5 posts)

  1. chaseman
    Posted 3 years ago #

    So I've created a custom admin panel for my theme that I'm developing. Now I'd like to have the options remembered.

    For example, there are form lists of options with check boxes or radio buttons next to them. Now I'd like to have those check boxes that the user clicked to be remembered (meaning to be automatically CHECKED) when the user calls another time the admin panel.

    I've seen this in WooThemes theme, though I don't know how they have done it.

    Any suggestions?

  2. GRAQ
    Posted 3 years ago #

    Try reading up on options: http://codex.wordpress.org/Option_Reference

  3. chaseman
    Posted 3 years ago #

    I've already solved it with this options, thanks for the tip.

    What I did was I got the values with get_option, then inserted the variable into the input field tag, and echo'd out "checked" if condition is true. If condition is not true, then it will not echo it out, and the check box will be unchecked.

  4. Mike Little
    Posted 3 years ago #

    There is a built in WordPress function you should use called checked. See http://codex.wordpress.org/Function_Reference/checked

    The function echoes (or not if you use the third parameter) the correct checked="checked" attribute.

  5. chaseman
    Posted 3 years ago #

    Thank you a BUNCH Mike, that will make my code look more concise I'll have to write all the if statements.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.