Articles of dropdown

Custom Taxonomy Select Menu: Setting default option value?

I’m creating a series of select drop down menus that pull data from various taxonomies. I got this PHP script working for a WooCommerce attribute of color: function get_color_dropdown($taxonomies, $args){ $myterms = get_terms($taxonomies, $args); $output =”<select onChange=’window.location.href=this.value’>”; foreach($myterms as $term){ $root_url = get_bloginfo(‘url’); $term_taxonomy=$term->taxonomy; $term_slug=$term->slug; $term_name =$term->name; $link = $root_url.’/’.$term_taxonomy.’/’.$term_slug; $output .=”<option value='”.$link.”‘>”.$term_name.”</option>”; } $output […]

Nav menu classes 'has-dropdown' but no 'active'

I have a nav menu with a depth of 2. wp_nav_menu( array( ‘theme_location’ => ‘primary_navigation’, ‘depth’ => 2 ) ); When I am active on a page in the nav menu that has no children, that li menu item has active appended. However, when the menu item has children, has-children is appended, but no ‘active’ […]

Adding archive years to my menu

I’m WordPress newbie and despite of reading many articles, I’m able to put archive years to my main menu. Menu contains pages and I need to add an archive. My current menu: – Home (page) – About (page) – News (Category) – Contact (page) And I need – Home (page) – About (page) – News […]

WP Dropdown Categories, display subcategories but not grandchildren categories?

So my main goal is to create 3 drop-down category options to run a search. It’s for a car website, so I have 3 parents, “Make”, “Model”, and “Year” At the moment I have the following code <?php $args = array(‘show_option_none’ => ‘Make’, child_of => 5,hide_empty => ‘0’,exclude => ‘0’); ?> <b>Make </b><?php wp_dropdown_categories($args); ?> […]

Add post type titles in customizer dropdown list

I want to add the list of my available contact forms (created in contact forms 7) to a dropdown in the customizer. Here is the code I used: function contact_form_list() { $args = array(‘post_type’ => ‘wpcf7_contact_form’); $cf7forms = get_posts( $args ); foreach($cf7forms as $cf7form) { return $cf7form->post_title; } } // Add setting and control for […]

Add search to 'Parent' dropdown

I created a product catalog from custom post type pages. I used it’s hierarchy to make menus and submenus. It looked like a great idea at a time… But now this catalog grew in size and it’s very hard to find something in ‘Parent’ dropdown. Is there a way to add search there?

Redirect wp_dropdown_pages() to an AJax request?

I want to get the result of wp_dropdown_pages() to fire an ajax request to show an image instead of redirecting the user to the page url. In other words, my pages are all for car models. I want to use the wordpress function to offer a list of the site’s available car models and display […]

Templates dropdown not appearing using _s theme (underscores)

I am currently using _s via http://underscores.me/ and am trying to add a new page template… I should be able to just add this new page template in the root of my theme, correct? Or should I be create a page-templates folder? I have tried something as simple as: <?php /** * Template Name: Front […]

WordPress custom dropdown listings

I have a site with a database of repair shops, by; Manufacturer – Venue I want 2 dropdown lists at the home page. In the first dropdown, when i select the “Apple” the second list appears in the places where they are “Apple” repair shops, and when i press the “Submit” button, it redirects me […]

How to create dependent dropdown custom field in wordpress admin post form

I want to create state and city dependent dropdown custom field in WordPress admin post form. So what approach I should follow ? Please suggest.