Hola como estan no puedo hacer que el value del primer a una variable del array del segundo select para que se modifique el contenido
se puede hacer?
Código PHP:
<select name="page-dropdown"
onchange='this.options[this.selectedIndex].value;'>
<option value="">
<?php echo esc_attr( __( 'Seleccionar destino' ) ); ?></option>
<?php
$args = array(
'sort_order' => 'ASC',
'sort_column' => 'post_title',
'hierarchical' => 1,
'exclude' => 10,
'include' => '',
'meta_key' => '',
'meta_value' => '',
'authors' => '',
'child_of' => 0,
'parent' => -1,
'exclude_tree' => '',
'number' => '',
'offset' => 0,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_pages( $args );
foreach ( $pages as $page ) {
$option = '<option value="' . $page->ID . '">';
$option .= $page->post_title;
$option .= '</option>';
echo $option;
}
?>
</select>
<select name="page-dropdown"
onchange='document.location.href=this.options[this.selectedIndex].value;'>
<option value="">
<?php echo esc_attr( __( 'Seleccionar Fechas' ) ); ?></option>
<?php
$args2 = array(
'sort_order' => 'ASC',
'sort_column' => 'post_title',
'hierarchical' => 1,
'exclude' => '',
'include' => '',
'meta_key' => '',
'meta_value' => '',
'authors' => '',
'child_of' => 2,
'parent' => -1,
'exclude_tree' => '',
'number' => '',
'offset' => 0,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages2 = get_pages( $args2 );
foreach ( $pages2 as $page2 ) {
$option2 = '<option value="' . get_page_link( $page2->ID ) . '">';
$option2 .= $page2->post_title;
$option2 .= '</option>';
echo $option2;
}
?>
</select>