Skip to content
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

Wrong All filter link when gallery on the Homepage #203

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading