Skip to content

Commit

Permalink
Merge pull request #21 from jjgrainger/v2.0.1
Browse files Browse the repository at this point in the history
V2.0.1
  • Loading branch information
jjgrainger authored Mar 27, 2018
2 parents 350ccad + ab2f996 commit 04525d3
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

##### v2.0.1
* merge [pull reqeuest #19](https://github.com/jjgrainger/PostTypes/pull/19): Use wp_dropdown_categories function for post filtering selectbox
* update minimum php version to 5.6

##### v2.0
* fix [issue #9](https://github.com/jjgrainger/PostTypes/issues/9): add unit tests
* fix [issue #12](https://github.com/jjgrainger/PostTypes/issues/12) and [issue #13](https://github.com/jjgrainger/PostTypes/issues/13): generating duplicate columns
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PostTypes v2.0
# PostTypes v2.0.1

[![Build Status](https://travis-ci.org/jjgrainger/PostTypes.svg?branch=master)](https://travis-ci.org/jjgrainger/PostTypes) [![Total Downloads](https://poser.pugx.org/jjgrainger/posttypes/downloads)](https://packagist.org/packages/jjgrainger/posttypes) [![Latest Stable Version](https://poser.pugx.org/jjgrainger/posttypes/v/stable)](https://packagist.org/packages/jjgrainger/posttypes) [![License](https://poser.pugx.org/jjgrainger/posttypes/license)](https://packagist.org/packages/jjgrainger/posttypes)

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jjgrainger/posttypes",
"version": "2.0",
"version": "2.0.1",
"description": "Simple WordPress custom post types.",
"homepage": "https://github.com/jjgrainger/posttype",
"license": "MIT",
Expand All @@ -13,7 +13,7 @@
],
"minimum-stability": "dev",
"require": {
"php": ">=5.3.0"
"php": ">=5.6"
},
"require-dev": {
"squizlabs/php_codesniffer": "^2.8",
Expand Down
29 changes: 15 additions & 14 deletions src/PostType.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,23 +397,24 @@ public function modifyFilters($posttype)

// start the html for the filter dropdown
$selected = null;

if (isset($_GET[$taxonomy])) {
$selected = sanitize_title($_GET[$taxonomy]);
}
$dropdown_args = array(
'option_none_value'=> '',
'hide_empty' => 0,
'hide_if_empty' => false,
'show_count' => true,
'taxonomy' => $tax->name,
'name' => $taxonomy,
'orderby' => 'name',
'hierarchical' => true,
'show_option_none' => "Show all {$tax->label}",
'value_field' => 'slug',
'selected' => $selected
);

$dropdown_args = [
'option_none_value' => '',
'hide_empty' => 0,
'hide_if_empty' => false,
'show_count' => true,
'taxonomy' => $tax->name,
'name' => $taxonomy,
'orderby' => 'name',
'hierarchical' => true,
'show_option_none' => "Show all {$tax->label}",
'value_field' => 'slug',
'selected' => $selected
];

wp_dropdown_categories($dropdown_args);
}
Expand Down

0 comments on commit 04525d3

Please sign in to comment.