-
Notifications
You must be signed in to change notification settings - Fork 216
fix: allow to use this theme an old php version #737
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
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 |
|---|---|---|
|
|
@@ -641,7 +641,7 @@ protected function add_term_archive_items() { | |
| if ( false !== $taxonomy->rewrite ) { | ||
|
|
||
| // If 'with_front' is true, dd $wp_rewrite->front to the trail. | ||
| if ( $taxonomy->rewrite['with_front'] && $wp_rewrite->front ) | ||
| if ( array_key_exists('with_front', $taxonomy->rewrite) && $taxonomy->rewrite['with_front'] && $wp_rewrite->front ) | ||
|
Contributor
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. Se deve essere controllata l'esistenza, perché non semplicemente
Collaborator
Author
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. ci potrebbero essere dei casi in cui with_font non era valorizzata, ecco perche questo check in più
Contributor
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. Sì; intendevo che |
||
| $this->add_rewrite_front_items(); | ||
|
|
||
| // Get parent pages by path if they exist. | ||
|
|
@@ -1112,7 +1112,7 @@ protected function get_post_types_by_slug( $slug ) { | |
|
|
||
| foreach ( $post_types as $type ) { | ||
|
|
||
| if ( $slug === $type->has_archive || ( true === $type->has_archive && $slug === $type->rewrite['slug'] ) ) | ||
| if ( $slug === $type->has_archive || ( true === $type->has_archive && is_array($type->rewrite) && isset($type->rewrite['slug']) && $slug === $type->rewrite['slug'])) | ||
|
Contributor
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. Non è un'eventualità piuttosto remota? |
||
| $return[] = $type; | ||
| } | ||
|
|
||
|
|
||
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.
Segnalo che WP ha anche una funzione is_tax(), che è più compatta e "idiomatica" e svolge già tutti i controlli su get_queried_object().
[v. #691]
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.
qui si è modificata la linea precedente, in quanto la versione presente andava in conflitto con versioni di PHP precedenti all'8.0
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.
Sì, infatti: è l'operatore nullsafe
?->, che non è supportato.Ma di tutta la sequenza delle verifiche su
get_queried_object->taxonomycredo che se ne potrebbe fare a meno, perché quello è proprio il mestiere diis_tax().