Php 使用“option selected value”突出显示select元素中的活动页面选项值
我在我的网站上使用一个自定义的wp查询,在一个列表样式中用select显示父页面中的所有页面,当选择一个页面时,我被重定向到正确的页面 工作正常: 这是我的密码:Php 使用“option selected value”突出显示select元素中的活动页面选项值,php,jquery,wordpress,html-lists,selectlist,Php,Jquery,Wordpress,Html Lists,Selectlist,我在我的网站上使用一个自定义的wp查询,在一个列表样式中用select显示父页面中的所有页面,当选择一个页面时,我被重定向到正确的页面 工作正常: 这是我的密码: <?php $args = array( 'post_type' => 'page', 'posts_per_page' => -1, 'post_parent' => '22',
<?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(); ?>
不,我正在尝试使用选项selected value高亮显示列表的活动页面。
在页面上时,我希望选择列表在列表中显示当前页面。
有人能帮我吗
我在网上找不到解决方案或方法。。。
我不确定这是否可能,但我想如果可能的话,一定是要添加到我的Wp查询或者jquery中
非常感谢您的帮助…您能提供指向您站点的链接吗?站点目前位于localhost上。。。我认为您不需要非链接?您的意思是每次只选择当前页面?不,我的意思是,在页面上,我希望列表样式位于当前页面的位置。与选项所选值的功能相同。我希望列表中的当前页面选项具有选项selected value class,您明白吗?是的,我知道了。你是说被选中了,对吗?