Support » Themes and Templates » Adding "Select your category" in the select list (category list)

  • Resolved anandmongol

    (@anandmongol)


    My idea is to add “Select your category” in the select list (category list), instead of showing one of the category from the category list.

    <select class="selectpicker" name="coupon_cat" id="category"value=">
    <?php
    $args = array (										'exclude'=> array(12)												);														$categories = get_categories($args);														    foreach($categories as $category) { ?>
        <option value="<?php echo $category->term_id;?>">
        <?php echo $category->name;?></option>												<?php } ?>
    </select>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Sorry for messed up code

    <select class="selectpicker" name="coupon_cat" id="category"value=">
    <?php
    $args = array ('exclude'=> array(12));
    $categories = get_categories($args);
        foreach($categories as $category) { ?>
        <option value="<?php echo $category->term_id;?>">
        <?php echo $category->name;?></option>
    <?php } ?
    </select>

    my bad, i just need to carefully follow the logic.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding "Select your category" in the select list (category list)’ is closed to new replies.