also replace header image in cover pages

This commit is contained in:
Leo Germani 2018-04-25 13:21:30 -03:00
parent abef1eeee8
commit 3f67dad6bd
2 changed files with 6 additions and 0 deletions

View File

@ -7,6 +7,8 @@ use Tainacan\Entities;
class Theme_Helper {
private static $instance = null;
public $visiting_collection_cover = false;
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
@ -161,6 +163,8 @@ class Theme_Helper {
global $wp_query;
$wp_query = new \WP_Query('page_id=' . $cover_page_id);
$this->visiting_collection_cover = $collection->get_id();
}
}

View File

@ -42,6 +42,8 @@ function tainacan_the_metadata($field = null, $hide_empty = true) {
function tainacan_get_collection_id() {
if ( is_post_type_archive() || is_single() ) {
return Repositories\Collections::get_instance()->get_id_by_db_identifier(get_post_type());
} elseif ( false !== \Tainacan\Theme_Helper::get_instance()->visiting_collection_cover ) {
return \Tainacan\Theme_Helper::get_instance()->visiting_collection_cover;
}
return false;
}