-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add districts with zipcodes, so the REST API can be filtered using a … #20
base: master
Are you sure you want to change the base?
Conversation
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.
Vergeet niet om de version bumps toe te voegen aan Foundation/Plugin.php, openpub-base.php en aan de CHANGELOG.md
@@ -107,4 +107,25 @@ public static function addTypeParameter(string $type): array | |||
] | |||
]; | |||
} | |||
|
|||
public static function addZipcodeParameter(string $zipcode): array |
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.
Eindigen met een happy path heeft mijn voorkeur:
public static function addZipcodeParameter(string $zipcode): array
{
global $wpdb;
$sql = "SELECT term_id FROM {$wpdb->termmeta} WHERE meta_key = '_owc_openpub_zipcode' AND meta_value = %s";
$results = $wpdb->get_col($wpdb->prepare($sql, (int)$zipcode));
if (! $results) {
return [];
}
return [
'tax_query' => [
[
'taxonomy' => 'openpub-district',
'terms' => $results,
'field' => 'term_id',
'operator' => 'IN'
]
]
];
}
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.
Dit heb ik aangepast.
# Conflicts: # languages/openpub-base-nl_NL.mo # languages/openpub-base-nl_NL.po # languages/openpub-base.pot # src/Base/RestAPI/Controllers/ItemController.php
Leek me logisch om dat pas te doen als de PR was gemerged, maar bij deze gedaan |
23a0d73
to
c20dfe4
Compare
@robertbossaert kun jij nog even checken, anders kan er niet gemerged worden. |
|
||
#: config/metaboxes.php:156 | ||
msgid "A zipcode that is part of this district. (Only numbers, no letters)" | ||
msgstr "Een postcode die bij deze wijk hoort. (Alleen cijfer, geen letters)" |
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.
Kun je hier nog cijfers
van maken
…zipcode.