962 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $10,000+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
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
  • Has been part of the Envato Community for over 4 years
  • Has referred 200+ members
  • Has sold $250,000+ on Envato Market
  • Had an item featured in an Envato Bundle
+7 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

962 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $10,000+ on Envato Market
  • Has collected 100+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
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

1148 posts
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+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