php - Add a class to my select element -
i want add class of "btn" select element. select element like
<select class="btn">
add class in code:
<form id="category-select" class="category-select" action="<?php echo esc_url( home_url( '/' ) ); ?>" method="get"> <?php $args = array( 'show_option_none' => __( 'select category' ), 'show_count' => 1, 'orderby' => 'name', 'echo' => 0, ); ?> <?php $select = wp_dropdown_categories( $args ); ?> <?php $replace = "<select$1 onchange='return this.form.submit()'>"; ?> <?php $select = preg_replace( '#<select([^>]*)>#', $replace, $select ); ?> <?php echo $select; ?> <noscript> <input type="submit" value="view" /> </noscript> </form>
the documentation shows option of 'class'
in args provide
$args = array( 'show_option_none' => __( 'select category' ), 'show_count' => 1, 'orderby' => 'name', 'echo' => 0, 'class' => 'btn' );
Comments
Post a Comment