Filters post in admin with dropdown select, custom post type

I’m trying to filter my post in my admin area with a custom filter dropdown. I use this method to make it: https://wordpress.stackexchange.com/a/45447/84541 Here is my code: add_action( ‘restrict_manage_posts’, ‘wpse45436_admin_posts_filter_restrict_manage_posts’ ); function wpse45436_admin_posts_filter_restrict_manage_posts(){ $type=”post”; if (isset($_GET[‘post_type’])) { $type = $_GET[‘post_type’]; } //only add filter to post type you want if (‘post’ == $type){ //change this … Read more

Display custom taxonomy as dropdown list

I want to display list of custom taxonomies as a dropdown list. I’ve found the solution here, @alexufo ‘s answer Display a custom taxonomy as a dropdown on the edit posts page But the problem with that is that when i publish the post with selected taxonomy it creates another taxonomy automatically. I can’t comment … Read more

How do I create a drop down menu in a widget?

How do I create a simple dropdown menu with 3 options in a widget? I’m using $instance to do it. How would it look in a barebones widget? 1 Answer 1 This is what I do: Static Options <select id=”<?php echo $this->get_field_id(‘posttype’); ?>” name=”<?php echo $this->get_field_name(‘posttype’); ?>” class=”widefat” style=”width:100%;”> <option <?php selected( $instance[‘posttype’], ‘Option 1’); … Read more

Replacing the NavWalker dropdown element

I’m creating a website for my school with Material Design for Bootstrap and the NavWalker is giving me some issues, I want to change the element of dropdown i.e. from ul to div. I’ve tried to edit the NavWalker. $output .= “\n$indent<div class=\” dropdown-menu dropdown-primary\” aria-labelledby=\”navbarDropdownMenuLink\” >\n”; I’ve edited the code and replaced the DIV … Read more

Saving two categories from two dropdowns in front end posting form

So, here’s the deal: I have two category dropdowns, the first for the parent categories and the second for the child categories. They form a chain so that when you select the parent category the second dropdown will be populated with its child categories. Here’s the code in the form itself: <script type=”text/javascript”> $(function() { … Read more

Dropdown: Display terms from B only if has relationship with a term A selected

I’ve googling for a solution for this issue and found nothing: I have some posts from a Custom Post Type (Restaurants) and its taxonomies (‘city’ and ‘cuisine’). Whenever I create a restaurant post, I can set many ‘cuisine’ terms as I want, but ‘city’ is single selected. I’ve also made a custom search using a … Read more