Skip to content

Commit 4104890

Browse files
VinsMachenrimk
andauthored
fix: allow to use this theme an old php version
Co-authored-by: enrimk <[email protected]>
1 parent cb219e9 commit 4104890

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

inc/actions.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ function dsi_eventi_filters( $query ) {
224224
*/
225225
function dsi_schede_progetti_filters( WP_Query $query ) {
226226

227-
if ( ! is_admin() && $query->is_main_query() && (is_post_type_archive("scheda_progetto") || (get_queried_object()?->taxonomy ?? null) == "tipologia-progetto") ) {
227+
if ( ! is_admin() && $query->is_main_query() && (is_post_type_archive("scheda_progetto") || is_tax("tipologia-progetto")) ) {
228+
//if ( ! is_admin() && $query->is_main_query() && (is_post_type_archive("scheda_progetto") || (get_queried_object()?->taxonomy ?? null) == "tipologia-progetto") ) {
228229

229230
$orderby = dsi_get_option("ordinamento_progetti", "didattica") ?? 'date';
230231
$order_direction = dsi_get_option("direzione_ordinamento_progetti", "didattica") === 'asc' ? 'asc' : 'desc';

inc/breadcrumb.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ protected function add_term_archive_items() {
641641
if ( false !== $taxonomy->rewrite ) {
642642

643643
// If 'with_front' is true, dd $wp_rewrite->front to the trail.
644-
if ( $taxonomy->rewrite['with_front'] && $wp_rewrite->front )
644+
if ( array_key_exists('with_front', $taxonomy->rewrite) && $taxonomy->rewrite['with_front'] && $wp_rewrite->front )
645645
$this->add_rewrite_front_items();
646646

647647
// Get parent pages by path if they exist.
@@ -1112,7 +1112,7 @@ protected function get_post_types_by_slug( $slug ) {
11121112

11131113
foreach ( $post_types as $type ) {
11141114

1115-
if ( $slug === $type->has_archive || ( true === $type->has_archive && $slug === $type->rewrite['slug'] ) )
1115+
if ( $slug === $type->has_archive || ( true === $type->has_archive && is_array($type->rewrite) && isset($type->rewrite['slug']) && $slug === $type->rewrite['slug']))
11161116
$return[] = $type;
11171117
}
11181118

inc/utils.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,4 +1231,17 @@ function dsi_get_progetti_in_luogo($luogo_id)
12311231

12321232
return $progetti;
12331233
}
1234+
}
1235+
1236+
1237+
1238+
if (!function_exists("dsi_get_page_by_title")) {
1239+
function dsi_get_page_by_title( $page_title ) {
1240+
return (new WP_Query([
1241+
'post_type' => 'page',
1242+
'title' => $page_title,
1243+
'post_status' => 'publish',
1244+
'posts_per_page' => 1,
1245+
]))->post;
1246+
}
12341247
}

0 commit comments

Comments
 (0)