Correctly sets items slug to be used in frontend

This commit is contained in:
leogermani 2018-12-12 17:37:56 -02:00
parent d17f348f7b
commit 968ffcbdb8
2 changed files with 7 additions and 3 deletions

View File

@ -181,7 +181,7 @@ class Admin {
'user_prefs' => $prefs,
'base_url' => $TAINACAN_BASE_URL,
'admin_url' => admin_url(),
'theme_items_list_url' => esc_url_raw( get_site_url()) . '/items',
'theme_items_list_url' => esc_url_raw( get_site_url() ) . '/' . \Tainacan\Theme_Helper::get_instance()->get_items_list_slug(),
'theme_collection_list_url' => get_post_type_archive_link( 'tainacan-collection' ),
'custom_header_support' => get_theme_support('custom-header'),
'registered_view_modes' => \Tainacan\Theme_Helper::get_instance()->get_registered_view_modes(),

View File

@ -350,10 +350,14 @@ class Theme_Helper {
}
function get_items_list_slug() {
/* Translators: The Items slug - will be the URL for the repository archive */
return sanitize_title(_x('items', 'Slug: the string that will be used to build the URL to list all items of the repository', 'tainacan'));
}
function rewrite_rules( &$wp_rewrite ) {
/* Translators: The Items slug - will be the URL for the repository archive */
$items_base = sanitize_title(_x('items', 'Slug: the string that will be used to build the URL to list all items of the repository', 'tainacan'));
$items_base = $this->get_items_list_slug();
$new_rules = array(
$items_base . "/?$" => "index.php?tainacan_repository_archive=1",