Skip to content

Commit

Permalink
fix: Use same fields for schema types as defined in Municipio Theme (#55
Browse files Browse the repository at this point in the history
)
  • Loading branch information
thorbrink authored Sep 18, 2024
1 parent 9384d5e commit 780840a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions source/php/Helper/GetPlacePostType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ public function getPlacePostTypes() {

private function filterPostTypes(): array
{
$postTypes = get_post_types();
if (empty($postTypes)) {
$filteredPostTypes = [];
$settings = get_field('post_type_schema_types', 'option');

if( empty($settings) ) {
return [];
}

$filteredPostTypes = [];
foreach ($postTypes as $postType) {
$schemaType = get_field('schema', $postType . '_options');
if ($schemaType === 'Place') {
$postTypeObject = get_post_type_object($postType);
foreach ($settings as $row) {

if ($row['schema_type'] === 'Place') {
$postTypeObject = get_post_type_object($row['post_type']);
$filteredPostTypes[$postTypeObject->name] = $postTypeObject->label;
}
}
Expand Down

0 comments on commit 780840a

Please sign in to comment.