-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Operator added to the widget #27
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ class Taxonomy_Drill_Down_Widget extends scbWidget { | |
'title' => '', | ||
'mode' => 'lists', | ||
'taxonomies' => array(), | ||
'operator' => '' | ||
); | ||
|
||
static function init( $file ) { | ||
|
@@ -77,13 +78,25 @@ function form( $instance ) { | |
'dropdowns' => __( 'dropdowns', 'query-multiple-taxonomies' ), | ||
), | ||
'text' => false, | ||
'desc' => __( 'Mode:', 'query-multiple-taxonomies' ), | ||
'desc' => __( 'Mode1:', 'query-multiple-taxonomies' ), | ||
'extra' => array( 'class' => 'widefat' ) | ||
), $instance ), | ||
'operator-input' => $this->input( array( | ||
'type' => 'select', | ||
'name' => 'operator', | ||
'values' => array( | ||
'AND' => __( 'And', 'query-multiple-taxonomies' ), | ||
'IN' => __( 'Or', 'query-multiple-taxonomies' ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use spaces here, not tabs: http://make.wordpress.org/core/handbook/coding-standards/php/#space-usage |
||
), | ||
'text' => false, | ||
'desc' => __( 'Operator:', 'query-multiple-taxonomies' ), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
'extra' => array( 'class' => 'widefat' ) | ||
), $instance ), | ||
|
||
'taxonomies-label' => __( 'Taxonomies:', 'query-multiple-taxonomies' ) | ||
); | ||
|
||
|
||
$selected_taxonomies = $instance['taxonomies']; | ||
|
||
// Start with the selected taxonomies | ||
|
@@ -119,7 +132,7 @@ function form( $instance ) { | |
|
||
function content( $instance ) { | ||
extract( $instance ); | ||
|
||
$taxonomies = array_filter( $taxonomies, array( __CLASS__, 'test_tax' ) ); | ||
|
||
$query = qmt_get_query(); | ||
|
@@ -132,7 +145,7 @@ function content( $instance ) { | |
} else { | ||
echo call_user_func( array( __CLASS__, "generate_$mode" ), $taxonomies, array( | ||
'reset-text' => __( 'Reset', 'query-multiple-taxonomies' ), | ||
'reset-url' => QMT_URL::get(), | ||
'reset-url' => QMT_URL::get(),'operator'=>$operator | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One key => value pair per line, please. |
||
) ); | ||
} | ||
} | ||
|
@@ -204,6 +217,7 @@ private function generate_dropdowns( $taxonomies, $data ) { | |
} | ||
|
||
private function generate_checkboxes( $taxonomies, $data ) { | ||
|
||
$data = array_merge( $data, array( | ||
'base-url' => QMT_URL::get_base(), | ||
'submit-text' => __( 'Submit', 'query-multiple-taxonomies' ), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not proud of these lines, since I think it can be written much better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, what's stopping you? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sunny days and lot of work! :P, but I'll improve it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't argue with sunny days. ☀️