Adds navigation option to items single page with next and previous links.

This commit is contained in:
mateuswetah 2020-07-19 00:14:04 -03:00
parent f82a9d7653
commit 52cb275182
4 changed files with 34 additions and 5 deletions

View File

@ -759,6 +759,7 @@ nav{
.page-template-landing-breadcrumb article section.tainacan-content {
&>div {
margin-top: 0;
margin-bottom: 0;
}
}

View File

@ -559,7 +559,7 @@ function tainacan_customize_register( $wp_customize ) {
) );
/**
* Adds options to control singe items page number of metadata columns.
* Adds options to control single items page number of metadata columns.
*/
$wp_customize->add_setting( 'tainacan_single_item_metadata_columns_count_tablet', array(
'type' => 'theme_mod',
@ -627,6 +627,24 @@ function tainacan_customize_register( $wp_customize ) {
)
) );
/**
* Adds options to display previous/next links on item single page.
*/
$wp_customize->add_setting( 'tainacan_single_item_show_next_previous_links', 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_next_previous_links', array(
'type' => 'checkbox',
'priority' => 3, // Within the section.
'section' => 'tainacan_single_item_page',
'label' => __( 'Show previous and next items links', 'tainacan-interface' ),
'description' => __( 'Toggle to display previous and next items links at te end of the page. This pagination is sorted by creation date only.', 'tainacan-interface' )
) );
if (version_compare(TAINACAN_VERSION, '0.16RC') >= 0) {
/**

File diff suppressed because one or more lines are too long

View File

@ -51,12 +51,22 @@
break;
}
echo '</div>';
get_template_part( 'template-parts/single-items-comments' );
?>
<?php if (get_theme_mod('tainacan_single_item_show_next_previous_links', false)): ?>
<div id="item-single-navigation" class="d-flex margin-pagination justify-content-between mt-0">
<div class="pagination">
<?php previous_post_link('<i class="tainacan-icon tainacan-icon-arrowleft tainacan-icon-1-25em"></i>&nbsp; %link'); ?>
</div>
<div class="pagination">
<?php next_post_link('%link &nbsp;<i class="tainacan-icon tainacan-icon-arrowright tainacan-icon-1-25em"></i>'); ?>
</div>
</div>
<?php endif; ?>
<?php get_template_part( 'template-parts/single-items-comments' ); ?>
</article>
<?php endwhile; ?>