Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

🎨 Add prefetch to all links and prevent scroll in pagination #87

Merged
merged 3 commits into from
Oct 20, 2022

Conversation

SantosGuillamot
Copy link
Contributor

I've added the prefetch property to all the links and scroll=false to all the pagination links. While doing so we realized that the HTML of the parent blocks contain the children, so we were parsing the HTML multiple times. For that, we change the filters to only trigger for the Query Loop and the Template Parts until we figure out a better solution.

Copy link
Member

@luisherranz luisherranz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely.

@@ -47,11 +47,18 @@ function add_wp_link_attribute($block_content)
}

$link = parse_url($w->get_attribute('href'));
$classes = $w->get_attribute('class');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a minimal optimization, but you can move this getter inside the if.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally right! I've just changed it 🙂

@SantosGuillamot SantosGuillamot merged commit 647589d into main-wp-directives-plugin Oct 20, 2022
@SantosGuillamot SantosGuillamot deleted the prefetch-and-scroll branch October 20, 2022 07:44
@luisherranz luisherranz changed the title Add prefetch to all links and prevent scroll in pagination 🎨 Add prefetch to all links and prevent scroll in pagination Oct 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants