fix: indentations

This commit is contained in:
vnmedeiros 2021-02-23 09:13:31 -03:00
parent d2d7cf3a10
commit 37852cb5da
1 changed files with 41 additions and 41 deletions

View File

@ -184,36 +184,36 @@ class Theme_Helper {
} }
/** /**
* Filters the permalink for posts to: * Filters the permalink for posts to:
* *
* * Replace Collection single permalink with the link to the post type archive for items of that collection * * Replace Collection single permalink with the link to the post type archive for items of that collection
* *
* @return string new permalink * @return string new permalink
*/ */
function permalink_filter($permalink, $post, $leavename) { function permalink_filter($permalink, $post, $leavename) {
$collection_post_type = \Tainacan\Entities\Collection::get_post_type(); $collection_post_type = \Tainacan\Entities\Collection::get_post_type();
if (!is_admin() && $post->post_type == $collection_post_type) { if (!is_admin() && $post->post_type == $collection_post_type) {
$collection = new \Tainacan\Entities\Collection($post); $collection = new \Tainacan\Entities\Collection($post);
if ( $collection->is_cover_page_enabled() ) { if ( $collection->is_cover_page_enabled() ) {
return $permalink; return $permalink;
} }
$items_post_type = $collection->get_db_identifier(); $items_post_type = $collection->get_db_identifier();
$post_type_object = get_post_type_object($items_post_type); $post_type_object = get_post_type_object($items_post_type);
if (isset($post_type_object->rewrite) && is_array($post_type_object->rewrite) && isset($post_type_object->rewrite['slug'])) if (isset($post_type_object->rewrite) && is_array($post_type_object->rewrite) && isset($post_type_object->rewrite['slug']))
return get_post_type_archive_link($items_post_type); return get_post_type_archive_link($items_post_type);
} }
return $permalink; return $permalink;
} }
function tax_archive_pre_get_posts($wp_query) { function tax_archive_pre_get_posts($wp_query) {
@ -489,33 +489,33 @@ class Theme_Helper {
} }
function rewrite_rules( &$wp_rewrite ) { function rewrite_rules( &$wp_rewrite ) {
$items_base = $this->get_items_list_slug(); $items_base = $this->get_items_list_slug();
$new_rules = array( $new_rules = array(
$items_base . "/?$" => "index.php?tainacan_repository_archive=1", $items_base . "/?$" => "index.php?tainacan_repository_archive=1",
$items_base . "/page/([0-9]+)/?$" => 'index.php?tainacan_repository_archive=1&paged=$matches[1]' $items_base . "/page/([0-9]+)/?$" => 'index.php?tainacan_repository_archive=1&paged=$matches[1]'
); );
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules; $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
} }
function rewrite_rules_query_vars( $public_query_vars ) { function rewrite_rules_query_vars( $public_query_vars ) {
$public_query_vars[] = "tainacan_repository_archive"; $public_query_vars[] = "tainacan_repository_archive";
return $public_query_vars; return $public_query_vars;
} }
function rewrite_rule_template_include( $template ) { function rewrite_rule_template_include( $template ) {
global $wp_query; global $wp_query;
if ( $wp_query->get( 'tainacan_repository_archive' ) == 1 ) { if ( $wp_query->get( 'tainacan_repository_archive' ) == 1 ) {
$templates = apply_filters('tainacan_repository_archive_template_hierarchy', ['tainacan/archive-repository.php', 'index.php']); $templates = apply_filters('tainacan_repository_archive_template_hierarchy', ['tainacan/archive-repository.php', 'index.php']);
return locate_template($templates, false); return locate_template($templates, false);
} }
return $template; return $template;
} }
function archive_repository_pre_get_posts($wp_query) { function archive_repository_pre_get_posts($wp_query) {
if (!$wp_query->is_main_query() || $wp_query->get( 'tainacan_repository_archive' ) != 1) if (!$wp_query->is_main_query() || $wp_query->get( 'tainacan_repository_archive' ) != 1)