fictioneer/partials/_collection-header.php

53 lines
1.6 KiB
PHP
Raw Normal View History

2023-01-21 01:31:34 +01:00
<?php
/**
* Partial: Collection Header
*
* Rendered in the single-fcn_collection.php template right after opening
* the <article> block.
*
* @package WordPress
* @subpackage Fictioneer
* @since 5.0.0
2023-01-21 01:31:34 +01:00
* @see single-fcn_collection.php
*
2023-08-19 22:22:56 +02:00
* @internal $args['collection'] Collection post object.
* @internal $args['collection_id'] The collection post ID.
* @internal $args['title'] Safe collection title.
* @internal $args['current_page'] Number of the current page or 1.
* @internal $args['max_pages'] Total number of pages or 1.
* @internal $args['featured_list'] IDs of featured items in the collection.
* @internal $args['featured_query'] Paginated query of featured items.
2023-01-21 01:31:34 +01:00
*/
// No direct access!
defined( 'ABSPATH' ) OR exit;
2023-01-21 01:31:34 +01:00
// Setup
$fandoms = get_the_terms( $args['collection_id'], 'fcn_fandom' );
$characters = get_the_terms( $args['collection_id'], 'fcn_character' );
$genres = get_the_terms( $args['collection_id'], 'fcn_genre' );
// Flags
$show_taxonomies = ! get_option( 'fictioneer_hide_taxonomies_on_pages' ) && ( $fandoms || $characters || $genres );
2023-01-21 01:31:34 +01:00
?>
<header class="collection__header">
<?php if ( $show_taxonomies ) : ?>
<div class="collection__taxonomies tag-group"><?php
echo fictioneer_get_taxonomy_pills(
array(
'fandoms' => $fandoms,
'genres' => $genres,
'characters' => $characters
2023-11-30 20:53:35 +01:00
),
'collection_header'
);
2023-01-21 01:31:34 +01:00
?></div>
<?php endif; ?>
<?php if ( ! empty( $args['title'] ) ) : ?>
<h1 class="collection__title"><?php echo $args['title']; ?></h1>
<?php endif; ?>
</header>