Inventory_Presser_Additional_Listings_Pages::add_rewrite_rules( array $rules )
Adds rewrite rules so WordPress recognizes the places where users want the additional listing pages to live.
On This Page
Parameters Parameters
- $rules
-
(array) (Required)
Return Return
(array)
Source Source
File: includes/class-additional-listings-pages.php
public function add_rewrite_rules( $rules ) {
foreach ( self::additional_listings_pages_array() as $additional_listing ) {
// is this rule valid and active?
if ( ! self::is_valid_rule( $additional_listing )
|| ! self::is_active_rule( $additional_listing ) ) {
continue;
}
// Base rule for this slug, this is not a post type.
$rules[ $additional_listing['url_path'] . '/?$' ] = 'index.php?post_type=' . INVP::POST_TYPE;
// Another rule to enable paging.
$rules[ $additional_listing['url_path'] . '/page/([0-9]{1,})/?$' ] = 'index.php?post_type=' . INVP::POST_TYPE . '&paged=$matches[1]';
}
return $rules;
}
Expand full source codeCollapse full source codeView on Github