Created
August 21, 2020 16:59
-
-
Save kodie/9f556b0b00859724298a3ab317ac4d06 to your computer and use it in GitHub Desktop.
This makes it possible to use `/page/` URLs with non-archive pages such as single pages in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This makes it possible to use `/page/` URLs with non-archive pages such as single pages | |
add_action('init', 'add_pagination_to_pages'); | |
function add_pagination_to_pages() { | |
$pages = array( | |
'flex/assessments' => 220460, | |
'flex/collections' => 215682, | |
'flex/lesson-plans' => 215685, | |
'flex/my-standards' => 220768, | |
'flex/resources' => 220383, | |
'flex/videos' => 190851, | |
'magazine' => 150395 | |
); | |
foreach ($pages as $path => $id) { | |
add_rewrite_rule($path . '/page/?([0-9]{1,})/?$', 'index.php?page_id=' . $id . '&paged=$matches[1]', 'top'); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment