Skip to content

Commit

Permalink
fixed the behavior of the "All" filters link when the gallery is set …
Browse files Browse the repository at this point in the history
…as the home page. (#203)
  • Loading branch information
Fellan-91 authored Apr 18, 2024
1 parent 68ccbeb commit aa4761f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions classes/class-archive-mapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,23 @@ public function add_filter_items( $terms, $vp_options ) {
$link = str_replace( $changed_part_of_link, $base_page, $term['url'] );
$link = $this->convert_category_to_friendly_url( $link );

/**
* When the portfolio archive page is set as the main page
* The filter with All the elements breaks
* A link of this type: mysite.com/portfolio/
* Must be forced to this: mysite.com
*/
if (
'*' === $term['filter'] &&
(int) get_option( 'page_on_front' ) === (int) $this->archive_page
) {
$portfolio_slug = self::get_portfolio_slug();

if ( ! empty( $portfolio_slug ) ) {
$link = str_replace( $portfolio_slug . '/', '', $link );
}
}

$terms[ $key ]['url'] = $link;
}
}
Expand Down

0 comments on commit aa4761f

Please sign in to comment.