WordPress.org

Forums

How to : Dropdown list in options page (2 posts)

  1. Phpdesign.si
    Member
    Posted 3 years ago #

    Hi,
    can someone please tell me how to make a dropdown of all categories in my theme options page?

    Thank you!

  2. Phpdesign.si
    Member
    Posted 3 years ago #

    <select name="theme_settings[something]">
    <?php
    
        $categories=  get_categories();
      foreach ($categories as $category) { ?>
    
        <option <?php if ($options['something'] == $category->category_nicename ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($category->category_nicename); ?></option>
        <?php } ?>
    
    </select>

Topic Closed

This topic has been closed to new replies.

About this Topic