Support » Developing with WordPress » Need help with checkbox “options”

  • SonicxXx


    Hi, guys…
    fiew days ago I found that there is an awesome option in wordpress get_option(‘sticky’) and now I want to change on an plugin that one with others checkboxes that already have on every post.
    example: I have an post sticky and when I get this code somewere it will get the sticky posts… and I want to add if there will be an other checkbox checked (like “Bonus” with id=”bonus”) and this post… without to be featured (sticky).

    now I have this code to imagine how is it:

    $aarl = get_option('sticky');
    $result_aarl       = array_intersect($aarl, $post_ID);
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz


    Where did you see this option? There is no “sticky” option in the options table by default. There is “sticky_posts”, which is an array of post IDs. So you can add any post ID to this array to make it sticky as well. Array intersect will isolate any ID that’s already there. The result will either be empty, or the post ID. Is that what you really want?

    Adding other check boxes is usually possible. Where do you want to add them? The check box status would need to be saved, then be used to alter applicable queries if that is what the check boxes are intended for. It’s not clear what you are really trying to do. Coding is very explicit, to get the help you want with coding, your description has to be explicit and complete.

    on classipress. it uses the custom post type and there are “sticky” ads.
    The code that I put on my fist post is from an plugin that hooks with that command the sticky ads and relist them. I just want to add enouther checkbox (example:the-new-checkbox) on the post.php page while editing the ad and change from get_option('sticky') to get_option('the-new-checkbox') on the code of plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.