wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema
build_dropdown_script_block_core_categories › WordPress Function
Desden/a
Obsoleton/a
› build_dropdown_script_block_core_categories ( $dropdown_id )
Parâmetros: |
|
Retorna: |
|
Definido em: |
|
Codex: |
Generates the inline script for a categories dropdown field.
Fonte
function build_dropdown_script_block_core_categories( $dropdown_id ) { ob_start(); ?> <script> ( function() { var dropdown = document.getElementById( '<?php echo esc_js( $dropdown_id ); ?>' ); function onCatChange() { if ( dropdown.options[ dropdown.selectedIndex ].value > 0 ) { location.href = "<?php echo esc_url( home_url() ); ?>/?cat=" + dropdown.options[ dropdown.selectedIndex ].value; } } dropdown.onchange = onCatChange; })(); </script> <?php return wp_get_inline_script_tag( str_replace( array( '<script>', '</script>' ), '', ob_get_clean() ) ); }