You can try this
<script type="text/javascript">
var dropdown = document.getElementById("cat");
function onCatChange() {
if ( dropdown.selectedIndex == 0 ) {
location.href = "https://wordpress.stackexchange.com/questions/90797/<?php echo get_option("home');?>";
}else if ( dropdown.selectedIndex > 0 ) {
location.href = "https://wordpress.stackexchange.com/questions/90797/<?php echo get_option("home');?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
}
}
dropdown.onchange = onCatChange;
</script>
Related Posts:
- Archive dropdown styling not applied
- Filter Select results based on selection
- How to pick the default selected value in wordpress dropdown?
- how to save selected option in variable for rest api category filter
- get taxonomy thumbnail and use it as a variable in code
- How to change logo by category
- Dropdown category field inside repeatable metabox
- How can i show specific Category List?
- Show subcategory name selected in specific category woocoommerce
- PHP drop down menu for my get_category child of
- Pass media upload value to input field
- What does the token %1$s in WordPress represent [closed]
- Display all posts in current category
- Second select list values are not saved after clicking update
- Where exactly do I write define( ‘WP_DEBUG’, true ) in wp-config file
- How to display related posts from parent category
- How can I set custom order use this function
- Select dropdown not showing selected value php
- Check if Product is in a Specific Category in Functions.php
- How can I add tinymce editor in WordPress with jQuery?
- Slide in Panel WordPress Post
- Using shipped version of jquery
- Category Thumbnail Display – How to display ONLY the main Category
- Bridging TinyMCE js and WordPress PHP?
- Trying to implement Ajax comments in WordPress, getting WP error
- class click counter save number
- Swapping wp_dropdown_categories function with wp_category_checklist
- Ajax – Call to undefined function get_option()
- Populate dropdown with Child Pages based on Parent Page chosen
- How to inject variables into public-facing JS using wp_enqueue_script
- JS file work only in index page
- How to change redirection route to a php page for making it only accessible by logged-in members?
- Integrating PHP into Javascript to display map markers with Google API – problem with wp_localize
- How to pass Select value from Javascript to PHP to generate select option on change
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- How does wp_enqueue_scripts work?
- WordPress Scripts Being Loaded in Footer
- how to show only specific category for a template
- wp_dropdown_pages auto submit
- Add Codepen animation as Preloader to WordPress
- Making an AJAX call to refresh a table
- How to array only one key from another array
- add onchange to select in a wp form
- load ajax using admin-ajax.php
- Displaying posts based on category
- Get categories names as an array to use it in theme settings
- How to get the last category name of a child category?
- HTML dropdown setting not showing last saved value in the database
- How to separate categories with commas?
- Show all tags within a category?
- Post repeated when opening in overlay, how do I solve this? [closed]
- Alphabetically Ordered Category in WordPress
- Loading Posts & Category with Ajax
- How to get current category
- Custom Taxonomy Select Menu: Setting default option value?
- Show parent categories of the current category
- How to check if a category has a parent and child categories?
- Is it possible to isolate and use WordPress functions outside of wordpress
- PHP variables in a post?
- Testing a Form’s Zipcode Field with Regular Expressions to Determine WordPress Page Behaviour
- security concerns if using html data-* attribute for l10n?
- I need to display posts in subcategory beside posts in main category
- Add Custom Category Description When Empty
- Order category posts by last word of custom field
- Add a product category to a specific product via a button
- Search bar for wp menu
- Executing php on button press
- Run do_shortcode on php template using JS function
- Trying to add some custom text into WordPress Post title via function.php
- How to Link to category titles if it is in the single post content?
- Using Javascript On Page – Header and Footer Now Missing
- How to show category just on specific pages?
- Adding extra data to shortcode attributes and pass it to JS with wp_localize_script
- Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test
- sessionStorage saves input value in browser but it is not loaded in the form field
- How to filter specific element of an array in wordpress/php?
- Replacing entire tag with shortcode – JavaScript [duplicate]
- How do I make comment-reply-button with that takes to comment reply form on click
- How to load WP_Editor JS files manually (with AJAX)?
- A javascript function that simply runs a php function on the plugin
- Display text of price (minus 20%) on every product page in a sentence.
- Populate an array from the loop, and then read the array into JS
- List categories assigned to a post
- Unable to get Post Category Name and URL
- Where to find the html for WordPress site? [closed]
- 500 (Internal Server Error) of external php file
- Add title and caption to thumbnail image on mouseover
- Problems with plugin that fetches data from database with ajax
- Dynamic Gallery
- Trying to see if page is category or single and displaying title with appropriate heading tag
- Cannot get custom javascript to execute on page
- category & sub category order issues in wordpress
- Fix incorrect related posts code snippet
- How to create and add js and css file when server is not on my PC?
- Object of class WP_Post could not be converted to string while trying to console.log wp_get_nav_menu_items
- Check radio get value to array
- How to create categories out of a list of words?
- Pass a PHP variable (loop-audio.php) to jQuery function (js/script.js)
- Set variable in javascript and using in my shortcode
- Is there a way of displaying related posts from lowest hyrachical order (lowest child category to parent category)