Skip to content

Commit

Permalink
fix: allow to use this theme an old php version
Browse files Browse the repository at this point in the history
Co-authored-by: enrimk <[email protected]>
  • Loading branch information
VinsMach and enrimk authored Jan 28, 2025
1 parent cb219e9 commit 4104890
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion inc/actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ function dsi_eventi_filters( $query ) {
*/
function dsi_schede_progetti_filters( WP_Query $query ) {

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

$orderby = dsi_get_option("ordinamento_progetti", "didattica") ?? 'date';
$order_direction = dsi_get_option("direzione_ordinamento_progetti", "didattica") === 'asc' ? 'asc' : 'desc';
Expand Down
4 changes: 2 additions & 2 deletions inc/breadcrumb.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
$this->add_rewrite_front_items();

// Get parent pages by path if they exist.
Expand Down Expand Up @@ -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']))
$return[] = $type;
}

Expand Down
13 changes: 13 additions & 0 deletions inc/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -1231,4 +1231,17 @@ function dsi_get_progetti_in_luogo($luogo_id)

return $progetti;
}
}



if (!function_exists("dsi_get_page_by_title")) {
function dsi_get_page_by_title( $page_title ) {
return (new WP_Query([
'post_type' => 'page',
'title' => $page_title,
'post_status' => 'publish',
'posts_per_page' => 1,
]))->post;
}
}

0 comments on commit 4104890

Please sign in to comment.