Adds partial edit link buttons to options on single items page.

This commit is contained in:
mateuswetah 2020-04-15 17:34:31 -03:00
parent d7f203dbf0
commit 56fea899d4
2 changed files with 45 additions and 13 deletions

View File

@ -262,7 +262,7 @@ function tainacan_customize_register( $wp_customize ) {
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => '3',
'transport' => 'refresh'
'transport' => 'postMessage'
) );
$wp_customize->add_control( 'tainacan_single_item_metadata_columns_count_desktop', array(
'type' => 'number',
@ -277,6 +277,12 @@ function tainacan_customize_register( $wp_customize ) {
'step' => 1
)
) );
$wp_customize->selective_refresh->add_partial( 'tainacan_single_item_metadata_columns_count_desktop',
array(
'selector' => '.single-item-collection--information .row',
'render_callback' => '__return_false',
'fallback_refresh' => true
) );
$wp_customize->add_setting( 'tainacan_single_item_metadata_columns_count_wide', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
@ -298,13 +304,13 @@ function tainacan_customize_register( $wp_customize ) {
) );
/**
* Adds options to display or not the thumbnail and share buttons on items page.
* Adds options to display or not the thumbnail on items page.
*/
$wp_customize->add_setting( 'tainacan_single_item_display_thumbnail', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => true,
'transport' => 'refresh'
'transport' => 'postMessage'
) );
$wp_customize->add_control( 'tainacan_single_item_display_thumbnail', array(
'type' => 'checkbox',
@ -313,11 +319,21 @@ function tainacan_customize_register( $wp_customize ) {
'label' => __( 'Display item thumbnail', 'tainacan-interface' ),
'description' => __( 'Toggle to show or not the item thumbnail, within the metadata list section.', 'tainacan-interface' )
) );
$wp_customize->selective_refresh->add_partial( 'tainacan_single_item_display_thumbnail',
array(
'selector' => '.tainacan-item-thumbnail-container',
'render_callback' => '__return_false',
'fallback_refresh' => true
) );
/**
* Adds options to display or not hare buttons on items page.
*/
$wp_customize->add_setting( 'tainacan_single_item_display_share_buttons', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => true,
'transport' => 'refresh'
'transport' => 'postMessage'
) );
$wp_customize->add_control( 'tainacan_single_item_display_share_buttons', array(
'type' => 'checkbox',
@ -326,6 +342,12 @@ function tainacan_customize_register( $wp_customize ) {
'label' => __( 'Display share buttons', 'tainacan-interface' ),
'description' => __( 'Toggle to show or not the social icon share buttons, within the metadata list section or collection banner.', 'tainacan-interface' )
) );
$wp_customize->selective_refresh->add_partial( 'tainacan_single_item_display_share_buttons',
array(
'selector' => '.tainacan-item-share-container',
'render_callback' => '__return_false',
'fallback_refresh' => true
) );
/**
* Adds option to display attachments and document as a gallery list.
@ -334,7 +356,7 @@ function tainacan_customize_register( $wp_customize ) {
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => false,
'transport' => 'refresh'
'transport' => 'postMessage'
) );
$wp_customize->add_control( 'tainacan_single_item_gallery_mode', array(
'type' => 'checkbox',
@ -343,7 +365,12 @@ function tainacan_customize_register( $wp_customize ) {
'label' => __( 'Show Document and Attachments grouped in one slider.', 'tainacan-interface' ),
'description' => __( 'Toggle to show the document and attachments in the same list, a carousel with the current item on top.', 'tainacan-interface' )
) );
$wp_customize->selective_refresh->add_partial( 'tainacan_single_item_gallery_mode',
array(
'selector' => '.single-item-collection--gallery, .single-item-collection--attachments',
'render_callback' => '__return_false',
'fallback_refresh' => true
) );
/**
* Adds option to display Collection banner on the item single page.
@ -352,7 +379,7 @@ function tainacan_customize_register( $wp_customize ) {
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => false,
'transport' => 'refresh'
'transport' => 'postMessage'
) );
$wp_customize->add_control( 'tainacan_single_item_collection_header', array(
'type' => 'checkbox',
@ -361,7 +388,12 @@ function tainacan_customize_register( $wp_customize ) {
'label' => __( 'Display a header of the related collection.', 'tainacan-interface' ),
'description' => __( 'Toggle to show a banner with name, thumbnail and color of the related collection.', 'tainacan-interface' )
) );
$wp_customize->selective_refresh->add_partial( 'tainacan_single_item_collection_header',
array(
'selector' => '.tainacan-single-item-heading',
'render_callback' => '__return_false',
'fallback_refresh' => true
) );
/**
* Adds section to control collection items page. ---------------------------------------------------------

View File

@ -69,7 +69,7 @@ if (get_theme_mod('tainacan_single_item_collection_header', false)) {
global $wp;
if (get_theme_mod( 'tainacan_single_item_display_share_buttons', true )) : ?>
<div class="collection-header--share">
<div class="btn trigger">
<div class="btn trigger tainacan-item-share-container">
<span class="tainacan-icon tainacan-icon-share"></span>
</div>
@ -99,7 +99,7 @@ if (get_theme_mod('tainacan_single_item_collection_header', false)) {
</div>
</div>
<?php endif; ?>
<div class="item-title aside-thumbnail">
<div class="tainacan-single-item-heading item-title aside-thumbnail">
<div class="title-page">
<p><?php echo __('Item', 'tainacan-interface') ?></p>
<h1><?php the_title(); ?></h1>
@ -111,7 +111,7 @@ if (get_theme_mod('tainacan_single_item_collection_header', false)) {
</div>
<?php else: ?>
<div class="tainacan-title">
<div class="tainacan-single-item-heading tainacan-title">
<div class="border-bottom border-jelly-bean tainacan-title-page" style="border-width: 2px !important;">
<ul class="list-inline mb-1">
<li class="list-inline-item text-midnight-blue font-weight-bold title-page">
@ -301,7 +301,7 @@ if (get_theme_mod('tainacan_single_item_collection_header', false)) {
<div class="row">
<div class="col s-item-collection--metadata">
<?php if (has_post_thumbnail() && get_theme_mod( 'tainacan_single_item_display_thumbnail', true )): ?>
<div class="card border-0 mb-3">
<div class="tainacan-item-thumbnail-container card border-0 mb-3">
<div class="card-body bg-white border-0 pl-0 pt-0 pb-1">
<h3><?php _e( 'Thumbnail', 'tainacan-interface' ); ?></h3>
<?php the_post_thumbnail('tainacan-medium-full', array('class' => 'item-card--thumbnail mt-2')); ?>
@ -310,7 +310,7 @@ if (get_theme_mod('tainacan_single_item_collection_header', false)) {
<?php endif; ?>
<?php if (!get_theme_mod('tainacan_single_item_collection_header', false) && get_theme_mod( 'tainacan_single_item_display_share_buttons', true )): ?>
<div class="card border-0 mb-3">
<div class="card-body bg-white border-0 pl-0 pt-0 pb-1">
<div class="tainacan-item-share-container card-body bg-white border-0 pl-0 pt-0 pb-1">
<h3><?php _e( 'Share', 'tainacan-interface' ); ?></h3>
<div class="btn-group" role="group">
<?php if ( true == get_theme_mod( 'tainacan_facebook_share', true ) ) : ?>