Skip to content

Commit

Permalink
fix: school notices (#751)
Browse files Browse the repository at this point in the history
* fix: resource taxonomies missing labels

* fix: notice when secondaryMenuItems not set

* fix: notice when eventsTitle not set

* fix: notice when taxonomy does not exist
  • Loading branch information
thorbrink authored Nov 9, 2023
1 parent bdad6de commit 6c14e5c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,14 @@ private function prepareArguments(): void
*/
private function prepareLabels(array $arguments): array
{
$arguments['labels'] = [];

if( isset($arguments['labels_name']) && !empty($arguments['labels_name']) ) {
$arguments['labels']['name'] = $arguments['labels_name'];
}

if (isset($arguments['labels_singular_name']) && !empty($arguments['labels_singular_name'])) {
$arguments['labels'] = ['singular_name' => $arguments['labels_singular_name']];
$arguments['labels']['singular_name'] = $arguments['labels_singular_name'];
}

return $arguments;
Expand Down
1 change: 1 addition & 0 deletions library/Controller/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public function __construct()

//Main Navigation
$this->data['primaryMenuItems'] = $primary->getMenuItems('main-menu', $this->getPageID(), \Kirki::get_option('primary_menu_pagetree_fallback'), true, !$this->data['customizer']->primaryMenuDropdown);
$this->data['secondaryMenuItems'] = null;

/**
* Get the secondary menu items based on the content type or post type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ private function attachmentToSliderItem($attachment): array
private function appendEventData()
{
$this->data['events'] = null;
$this->data['eventsTitle'] = null;

if( !post_type_exists(self::EVENT_POST_TYPE) || !taxonomy_exists(self::EVENT_TAXONOMY) ) {
return;
Expand Down
2 changes: 1 addition & 1 deletion library/Helper/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ protected static function getPostTerms($postId, $includeLink = true, $taxonomies
foreach ($taxonomies as $taxonomy) {
$terms = wp_get_post_terms($postId, $taxonomy);

if (!empty($terms)) {
if (!is_wp_error($terms) && !empty($terms)) {
foreach ($terms as $term) {
$item = [];

Expand Down

0 comments on commit 6c14e5c

Please sign in to comment.