962 posts
  • Bought between 100 and 499 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Ireland
  • Sold between 10 000 and 50 000 dollars
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
  • Author had a File in an Envato Bundle
  • Bought between 1 and 9 items
  • Elite Author
  • Europe
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 100 and 199 users
+2 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
  • Bought between 100 and 499 items
  • Exclusive Author
  • Has been a member for 5-6 years
  • Ireland
  • Sold between 10 000 and 50 000 dollars
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
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
  • Has been a member for 4-5 years
  • Bought between 10 and 49 items
  • Exclusive Author
  • Envato Studio (Microlancer) Beta Tester
  • United States
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