Skip to content

Commit

Permalink
Add filters for ordering
Browse files Browse the repository at this point in the history
* Adds `wds_react_post_search_order` filter for changing order
* Adds `wds_react_post_search_orderby` filter for changing orderby
  • Loading branch information
davebonds committed Nov 27, 2018
1 parent 653cf2d commit ae3f211
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion class-wds-react-post-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WDS React Post Search
* Description: Power up the basic WordPress search with React.
* Plugin URI: https://www.webdevstudios.com
* Version: 1.0.2
* Version: 1.0.3
*
* With help from:
* https://www.ibenic.com/wordpress-react-search/
Expand Down Expand Up @@ -391,6 +391,8 @@ public function search_posts( $request ) {
'post_type' => $this->get_valid_search_post_types( $request ),
's' => sanitize_text_field( $request['s'] ),
'tax_query' => apply_filters( 'wds_react_post_search_tax_query', array() ),
'order' => apply_filters( 'wds_react_post_search_order', 'DESC' ),
'orderby' => apply_filters( 'wds_react_post_search_orderby', 'date' ),
];

// Get posts.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wds-react-post-search",
"version": "1.0.2",
"version": "1.0.3",
"description": "Power up the basic WordPress search field with React.",
"main": "assets/js/public.js",
"dependencies": {
Expand Down

0 comments on commit ae3f211

Please sign in to comment.