Adds option to navigate trught adjacent items and to the source list from the item single page header.
This commit is contained in:
parent
cae6ed82f6
commit
d7cdecc036
|
@ -162,6 +162,9 @@
|
||||||
span {
|
span {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
i.tainacan-icon-viewtable::before {
|
||||||
|
transform: scale(0.6);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
img{
|
img{
|
||||||
|
|
|
@ -515,6 +515,29 @@ function tainacan_customize_register( $wp_customize ) {
|
||||||
'fallback_refresh' => true
|
'fallback_refresh' => true
|
||||||
) );
|
) );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds options to hide item naviagtion options.
|
||||||
|
*/
|
||||||
|
$wp_customize->add_setting( 'tainacan_single_item_show_navigation_options', array(
|
||||||
|
'type' => 'theme_mod',
|
||||||
|
'capability' => 'edit_theme_options',
|
||||||
|
'default' => false,
|
||||||
|
'transport' => 'refresh',
|
||||||
|
'sanitize_callback' => 'tainacan_callback_sanitize_checkbox'
|
||||||
|
) );
|
||||||
|
$wp_customize->add_control( 'tainacan_single_item_show_navigation_options', array(
|
||||||
|
'type' => 'checkbox',
|
||||||
|
'priority' => 2, // Within the section.
|
||||||
|
'section' => 'tainacan_single_item_page',
|
||||||
|
'label' => __( 'Show the item navigation options in the page header', 'tainacan-interface' ),
|
||||||
|
'description' => __( 'Toggle to display tow arros and a list icon for navigating directly from the item page header.', 'tainacan-interface' )
|
||||||
|
) );
|
||||||
|
$wp_customize->selective_refresh->add_partial( 'tainacan_single_show_hide_navigation_options', array(
|
||||||
|
'selector' => '.tainacan-single-post #header-meta_pagination',
|
||||||
|
'render_callback' => '__return_false',
|
||||||
|
'fallback_refresh' => true
|
||||||
|
) );
|
||||||
|
|
||||||
if (version_compare(TAINACAN_VERSION, '0.16RC') >= 0) {
|
if (version_compare(TAINACAN_VERSION, '0.16RC') >= 0) {
|
||||||
/**
|
/**
|
||||||
* Adds options to display or not the document download button.
|
* Adds options to display or not the document download button.
|
||||||
|
|
|
@ -125,7 +125,6 @@ function tainacan_filter_cancel_comment_reply_link( $formatted_link, $link, $tex
|
||||||
}
|
}
|
||||||
add_filter( 'cancel_comment_reply_link', 'tainacan_filter_cancel_comment_reply_link', 10, 3 );
|
add_filter( 'cancel_comment_reply_link', 'tainacan_filter_cancel_comment_reply_link', 10, 3 );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves an item adjacent link, either using WP strategy or Tainacan plugin tainacan_get_adjacent_items()
|
* Retrieves an item adjacent link, either using WP strategy or Tainacan plugin tainacan_get_adjacent_items()
|
||||||
*
|
*
|
||||||
|
@ -226,3 +225,22 @@ function tainacan_get_adjacent_item_links($thumbnail = null) {
|
||||||
|
|
||||||
return ['next' => $next, 'previous' => $previous];
|
return ['next' => $next, 'previous' => $previous];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the current items list source link
|
||||||
|
*/
|
||||||
|
function tainacan_get_source_item_list_url() {
|
||||||
|
$args = $_GET;
|
||||||
|
if (isset($args['ref'])) {
|
||||||
|
$ref = $_GET['ref'];
|
||||||
|
unset($args['pos']);
|
||||||
|
unset($args['ref']);
|
||||||
|
unset($args['source_list']);
|
||||||
|
return $ref . '?' . http_build_query(array_merge($args));
|
||||||
|
} else {
|
||||||
|
unset($args['pos']);
|
||||||
|
unset($args['ref']);
|
||||||
|
unset($args['source_list']);
|
||||||
|
return tainacan_the_collection_url() . '?' . http_build_query(array_merge($args));
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -187,17 +187,21 @@ $next = $adjacent_links['next'];
|
||||||
echo '</span>';
|
echo '</span>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div style="height: 1.125rem;" class="ml-auto d-flex justify-content-between">
|
<?php if (get_theme_mod('tainacan_single_item_show_navigation_options', false)) : ?>
|
||||||
|
<div
|
||||||
|
id="header-meta_pagination"
|
||||||
|
style="height: 1.125rem;" class="ml-auto d-flex justify-content-between">
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
<?php echo $previous; ?>
|
<?php echo $previous; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
<a href="<?php tainacan_the_collection_url(); ?>"><i class="tainacan-icon tainacan-icon-viewtable tainacan-icon-1-25em"></i></a>
|
<a href="<?php echo tainacan_get_source_item_list_url(); ?>"><i class="tainacan-icon tainacan-icon-viewtable tainacan-icon-30px"></i></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="pagination">
|
<div class="pagination">
|
||||||
<?php echo $next; ?>
|
<?php echo $next; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue