Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
$8
Category Drop Down in Plugin Options
<select name='radar_options[blog_category]'>
<?php
$categories=get_categories();
foreach($categories as $category) {
$selected = '';
$selected = 'selected="selected"';
echo '<option value="' . $radar_options['blog_category'] . '" ' . $selected . '>' . $category->name . '</option>';
}
?>
</select>
Any help would be appreciated!
Mike
This question has been answered.
Mike McAlister | 06/29/12 at 4:25pm
Edit
(2) Possible Answers Submitted...
See a chronological view of answers?
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
-

Last edited:
06/29/12
4:30pmLuis Abarca says:
wp_dropdown_categories
http://codex.wordpress.org/Function_Reference/wp_dropdown_categoriesPrevious versions of this answer: 06/29/12 at 4:30pm
- 06/29/12 4:31pm
Mike McAlister says:No, not that easy. This is for plugin settings, so you can't just paste wp_dropdown_categories in there.
Mike - 06/29/12 4:35pm
Luis Abarca says:Just get the category from your plugin options
$radar_options = get_option('radar_options');
$category_selected = $radar_options['blog_category'];
wp_dropdown_categories(array('name' => "radar_options[blog_category]", 'selected' => $category_selected) );
- 06/29/12 4:53pm
Mike McAlister says:This does bring in the categories as it should, but it doesn't seem to be saving. I've tried to echo out the blog_category setting and it returns blank.
- 06/29/12 4:56pm
Mike McAlister says:Apologies, it DOES work. I had another option resetting it by accident. Good stuff, Luis.
- 06/29/12 4:31pm
-
Last edited:
06/29/12
4:53pmKailey Lampert says:Luis' answer looks good to me. Where's it falling short for your needs?
- 06/29/12 4:53pm
Mike McAlister says:This does bring in the categories as it should, but it doesn't seem to be saving. I've tried to echo out the blog_category setting and it returns blank.
- 06/29/12 4:56pm
Mike McAlister says:He was right, I had a stupid piece of duplicate code screwing things up. D'oh!
- 06/29/12 4:53pm
This question has expired.
Mike McAlister, Gabriel Reguly, Hai Bui, Arnav Joy voted on this question.
Current status of this question: Completed
Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.
If the asker does not get an answer then they have 10 days to request a refund.
