Adds option to change sections order in items single page. #25

This commit is contained in:
mateuswetah 2020-04-16 13:42:11 -03:00
parent 6d6d815a96
commit c90a386bb5
2 changed files with 58 additions and 8 deletions

View File

@ -389,6 +389,29 @@ function tainacan_customize_register( $wp_customize ) {
'render_callback' => '__return_false',
'fallback_refresh' => true
) );
/**
* Adds option to display attachments and document as a gallery list.
*/
$wp_customize->add_setting( 'tainacan_single_item_layout_sections_order', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => 'document-attachments-metadata',
'transport' => 'refresh'
) );
$wp_customize->add_control( 'tainacan_single_item_layout_sections_order', array(
'type' => 'select',
'priority' => -1, // Within the section.
'section' => 'tainacan_single_item_page',
'label' => __( 'Layout sections order.', 'tainacan-interface' ),
'description' => __( 'Display the document, attachments and metadata sections in different order.', 'tainacan-interface' ),
'choices' => array(
'document-attachments-metadata' => __('Document - Attachments - Metadata', 'tainacan-interface'),
'metadata-document-attachments' => __('Metadata - Document - Attachments', 'tainacan-interface'),
'document-metadata-attachments' => __('Document - Metadata - Attachments', 'tainacan-interface'),
)
) );
/**
* Adds section to control collection items page. ---------------------------------------------------------

View File

@ -14,14 +14,41 @@
get_template_part( 'template-parts/single-items-header' );
do_action( 'tainacan-interface-single-item-after-title' );
get_template_part( 'template-parts/single-items-document' );
do_action( 'tainacan-interface-single-item-after-document' );
get_template_part( 'template-parts/single-items-attachments' );
do_action( 'tainacan-interface-single-item-after-attachments' );
get_template_part( 'template-parts/single-items-metadata' );
do_action( 'tainacan-interface-single-item-after-metadata' );
switch (get_theme_mod( 'tainacan_single_item_layout_sections_order', 'document-attachments-metadata')) {
case 'document-attachments-metadata':
get_template_part( 'template-parts/single-items-document' );
do_action( 'tainacan-interface-single-item-after-document' );
get_template_part( 'template-parts/single-items-attachments' );
do_action( 'tainacan-interface-single-item-after-attachments' );
get_template_part( 'template-parts/single-items-metadata' );
do_action( 'tainacan-interface-single-item-after-metadata' );
break;
case 'metadata-document-attachments':
get_template_part( 'template-parts/single-items-metadata' );
do_action( 'tainacan-interface-single-item-after-metadata' );
get_template_part( 'template-parts/single-items-document' );
do_action( 'tainacan-interface-single-item-after-document' );
get_template_part( 'template-parts/single-items-attachments' );
do_action( 'tainacan-interface-single-item-after-attachments' );
break;
case 'document-metadata-attachments':
get_template_part( 'template-parts/single-items-document' );
do_action( 'tainacan-interface-single-item-after-document' );
get_template_part( 'template-parts/single-items-metadata' );
do_action( 'tainacan-interface-single-item-after-metadata' );
get_template_part( 'template-parts/single-items-attachments' );
do_action( 'tainacan-interface-single-item-after-attachments' );
break;
}
get_template_part( 'template-parts/single-items-comments' );
?>