Skip to content
This repository was 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
SantosGuillamot merged 3 commits intomain-wp-directives-pluginfrom
prefetch-and-scroll
Oct 20, 2022
Merged

🎨 Add prefetch to all links and prevent scroll in pagination#87
SantosGuillamot merged 3 commits intomain-wp-directives-pluginfrom
prefetch-and-scroll

Conversation

@SantosGuillamot
Copy link
Copy Markdown
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
Copy Markdown
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.

}

$link = parse_url($w->get_attribute('href'));
$classes = $w->get_attribute('class');
Copy link
Copy Markdown
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
Copy Markdown
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