php - highlight active page option value in select element using "option selected value" -
i'm using custom wp-query on website display pages parent page inside list style select, when selecting page i'm redirected right page.
works fine :
here code :
<?php $args = array( 'post_type' => 'page', 'posts_per_page' => -1, 'post_parent' => '22', 'order' => 'asc', 'orderby'=>'meta_value', 'meta_key'=>'nom_de_loeuvre' ); $parent = new wp_query( $args ); if ( $parent->have_posts() ) : ?> <span class="styled-select"> <select name="" onchange="location = this.options[this.selectedindex].value;"> <option>a - z</option> <?php while ( $parent->have_posts() ) : $parent->the_post(); ?> <option value="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <?php the_field('nom_de_loeuvre'); ?> , de <?php if(get_field('prenom_artiste')): ?> <?php the_field('prenom_artiste'); ?> <?php endif ;?> <?php the_field('nom_artiste'); ?> | galerie <?php if(get_field('prenom_galerie')): ?> <?php the_field('prenom_galerie'); ?> <?php endif ;?> <?php the_field('nom_galerie'); ?> </option> <?php endwhile; ?> </select> </span> <?php endif; wp_reset_query(); ?>
no i'm trying hightlight active page of list, using "option selected value". when on page, want select list display current page in liste. can me ?
i can't find solution or way on web... i'm not sure if it's possible, guess if is, must add in wp-query or maybe in jquery ?
thanks lot help...
Comments
Post a Comment