Fixes post navigation function not bewing redeclared when using plugin.
This commit is contained in:
parent
bb71302a2d
commit
cefebd6db5
|
@ -317,9 +317,17 @@ if ( !function_exists('blocksy_tainacan_item_navigation') ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* The following has to happen on hook plugins_loaded because the parent theme
|
||||||
|
* has already declared the function in the plugin lifecycle, somehting that
|
||||||
|
* is not necessary if on a child theme.
|
||||||
|
*/
|
||||||
|
if (BLOCKSY_TAINACAN_IS_PLUGIN) {
|
||||||
|
function blocksy_tainacan_after_theme_setup() {
|
||||||
|
|
||||||
|
/**
|
||||||
* Overrides parent theme blocksy post navigation logic to handle items navigation
|
* Overrides parent theme blocksy post navigation logic to handle items navigation
|
||||||
*/
|
*/
|
||||||
function blocksy_post_navigation() {
|
function blocksy_post_navigation() {
|
||||||
|
|
||||||
// This should only happen if we have Tainacan plugin installed
|
// This should only happen if we have Tainacan plugin installed
|
||||||
if ( defined ('TAINACAN_VERSION') ) {
|
if ( defined ('TAINACAN_VERSION') ) {
|
||||||
|
@ -332,6 +340,27 @@ function blocksy_post_navigation() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return blocksy_default_post_navigation();
|
return blocksy_default_post_navigation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action( 'plugins_loaded', 'blocksy_tainacan_after_theme_setup' );
|
||||||
|
} else {
|
||||||
|
/**
|
||||||
|
* Overrides parent theme blocksy post navigation logic to handle items navigation
|
||||||
|
*/
|
||||||
|
function blocksy_post_navigation() {
|
||||||
|
|
||||||
|
// This should only happen if we have Tainacan plugin installed
|
||||||
|
if ( defined ('TAINACAN_VERSION') ) {
|
||||||
|
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
|
||||||
|
$post_type = get_post_type();
|
||||||
|
|
||||||
|
// Check if we're inside the main loop in a single Post.
|
||||||
|
if (in_array($post_type, $collections_post_types) && is_singular() && in_the_loop() && is_main_query() ) {
|
||||||
|
return blocksy_tainacan_item_navigation();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return blocksy_default_post_navigation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue