-
Notifications
You must be signed in to change notification settings - Fork 368
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
Replace strings with constants in WP_Job_Manager_Post_Types #2687
Conversation
The idea here is to unify the $selected_category logic and also make it use constants related to the taxonomy constant for listing categories
Just in a single commit because it is really a bunch of capabilities
…ivate_job_listings'
…published_job_listings'
…ers_job_listings'
…ished_job_listings'
7197968
to
8117aa5
Compare
$selected_category = isset( $_GET['job_listing_category'] ) ? sanitize_text_field( wp_unslash( $_GET['job_listing_category'] ) ) : ''; | ||
echo "<select name='job_listing_category' id='dropdown_job_listing_category'>"; | ||
echo '<option value="" ' . selected( $selected_category, '', false ) . '>' . esc_html__( 'Select category', 'wp-job-manager' ) . '</option>'; | ||
echo "<select name='" . esc_attr( \WP_Job_Manager_Post_Types::TAX_LISTING_CATEGORY ) . "' id='dropdown_job_listing_category'>"; |
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.
Do we also want to use the constant in a place like this? id='dropdown_job_listing_category'
?
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 thought about doing so, but I think the main issue with that is that id
is the sort of attribute that might be used from the CSS/JS side to handle the field somehow (e.g., select2 stuff, for instance).
And given that passing these constants to the JS side just to handle this looks a bit..too much, I decided just to leave it as it is. Right now, this whole "replacing magical strings with constants" looks already challenging enough (in the sense of risk of breaking things)
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.
Thanks for taking on this task, @fjorgemota !
I looked through every replacement and double checked them and they all look good! I left a non-blocking question about if we want to use Constants in some class names.
Fixes #2663
Changes Proposed in this Pull Request
WP_Job_Manager_Post_Types
Testing Instructions
Test if the plugin is generally work. Some examples:
Release Notes