trying to create a drop-down menu where the items are the children pages of a given parent page. The list has an autosubmit script.
I'd like to add some css rule but unable to do so. Moreover, I see the following warning appearing briefly everytime I do edit the page where I test the code:
Cannot modify header information - headers already sent by (output started at /etc etc)
Many thanks in advance
Here's the code, not mine really: source
function dropdownbox_autosubmit() {
wp_dropdown_pages(array('child_of' => 42,'show_option_none=Select Page')); ?>
<script type="text/javascript">
var pageDropdown = document.getElementById("page_id");
pageDropdown.onchange = onPageSelect;
function onPageSelect() {
if ( pageDropdown.options[pageDropdown.selectedIndex].value > 0 ) {
location.href = "<?php echo get_option('home');?>/post.php?page_id="+pageDropdown.options[pageDropdown.selectedIndex].value;
}
}
</script>
<?php
}
add_shortcode( 'call_dropdownbox_autosubmit', 'dropdownbox_autosubmit' );