diff --git a/functions.php b/functions.php index 4aacc16..ce155a5 100644 --- a/functions.php +++ b/functions.php @@ -4,7 +4,7 @@ if (! defined('WP_DEBUG')) { } /** Theme version */ -const BLOCKSY_TAINACAN_VERSION = '0.0.1'; +const BLOCKSY_TAINACAN_VERSION = '0.1.0'; /** * Enqueue scripts and styles. @@ -23,7 +23,7 @@ add_action( 'wp_enqueue_scripts', function () { // Now, some dynamic css that is generated using blocksy dynamic css logic add_action('blocksy:global-dynamic-css:enqueue', function ($args) { blocksy_theme_get_dynamic_styles(array_merge([ - 'path' => get_stylesheet_directory() . '/global.php', + 'path' => get_stylesheet_directory() . '/inc/global.php', 'chunk' => 'global', 'forced_call' => true ], $args)); @@ -36,8 +36,8 @@ add_action( 'wp_enqueue_scripts', function () { function blocksy_tainacan_get_adjacent_item_links() { $prefix = blocksy_manager()->screen->get_prefix(); - $has_thumb = get_theme_mod($prefix . '_has_post_nav_thumb', 'yes') === 'yes'; + // We use Tainacan own method for obtaining previous and next item objects if (function_exists('tainacan_get_adjacent_items') && isset($_GET['pos'])) { $adjacent_items = tainacan_get_adjacent_items(); @@ -64,6 +64,11 @@ function blocksy_tainacan_get_adjacent_item_links() { $next_title = get_the_title( get_next_post() ); } + // Then we obtain blocksy settings + $has_thumb = get_theme_mod($prefix . '_has_post_nav_thumb', 'yes') === 'yes'; + + $has_title = get_theme_mod($prefix . '_has_post_nav_title', 'yes') === 'yes'; + $previous = ''; $next = ''; @@ -100,9 +105,6 @@ function blocksy_tainacan_get_adjacent_item_links() { ] ); - } else { - $previous = $previous_link_url === false ? '' : ''; - $next = $next_link_url === false ? '' :''; } // Creates the links @@ -111,7 +113,7 @@ function blocksy_tainacan_get_adjacent_item_links() { ($has_thumb ? $previous_post_image_output : '') . '
' . '' . __( 'Previous item', 'blocksy-tainacan' ) . '' . - (!empty( $previous_title ) ? ('' . $previous_title . '') : '') . + (( !empty( $previous_title ) && $has_title ) ? ('' . $previous_title . '') : '') . '
'. ''); @@ -119,7 +121,7 @@ function blocksy_tainacan_get_adjacent_item_links() { ''); @@ -130,6 +132,7 @@ function blocksy_tainacan_get_adjacent_item_links() { /** * Copy of blocksy original post navigation function. + * Check inc/template-tags.php post navigation file on the parent theme */ function blocksy_default_post_navigation() { $next_post = apply_filters( diff --git a/global.php b/inc/global.php similarity index 100% rename from global.php rename to inc/global.php diff --git a/package.json b/package.json index 746bde7..25022a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blocksy-tainacan", - "version": "1.0.0", + "version": "0.1.0", "description": "A Blocksy child theme compatible with Tainacan", "main": "index.js", "scripts": {