971 posts
  • 6 Years of Membership
  • Author Level 5
  • Collector Level 4
  • Exclusive Author
EireStudio
says

I have listed the categories and when I tick them, they update in the database correctly, but how do I output a ticked category ? :S

<p class="select clearfix">
      <label>Checkbox Category</label>
      <?php $categories = get_categories(); 
      foreach($categories as $category){ ?>
            <span><?php echo $category?>cat_name; ?></span>
            <input name="eirepanel_general_options_checkbox[]" type="checkbox" value="<?php echo $category?>cat_ID; ?>" 
                  <?php if ($eirepanel_general_options['checkbox'] == $category?>cat_ID) { echo 'checked'; } ?> 
            />
      <?php } ?> 
</p>
3007 posts
  • 5 Years of Membership
  • Affiliate Level 5
  • Author Level 9
  • Bundle Boss
+8 more
duotive
says

had the same problem. :) add the categories in a string like 1,34,5,6 save them, and when you get the saved string from the meta, explode it in an array and search for the searched category with in_array :D

971 posts
  • 6 Years of Membership
  • Author Level 5
  • Collector Level 4
  • Exclusive Author
EireStudio
says

had the same problem. :) add the categories in a string like 1,34,5,6 save them, and when you get the saved string from the meta, explode it in an array and search for the searched category with in_array :D

Thanks mate.

Finally did it!!!!!! I am saving my entire theme options in a single array and I had the hardest time figuring it out, but I just got it to work, am so happy!!! :D :P

1149 posts
  • Affiliate Level 1
  • Author Level 3
  • Beta Tester
  • Collector Level 2
+3 more
fillerspace
says

I am saving my entire theme options in a single array and I had the hardest time figuring it out

That’s what I’m doing in my theme (actually separate arrays for colors, fonts, etc). It makes it easy to do things like export everything to xml or convert to json to use in javascript.

by
by
by
by
by
by