From 84273c9deaabf2651b686cfa2b488b818df28630 Mon Sep 17 00:00:00 2001 From: mateuswetah Date: Mon, 9 May 2022 17:17:33 -0300 Subject: [PATCH] Initial support to metadata sections. --- .../tainacan-items-page-search-area.php | 46 +++++----- src/template-parts/single-items-metadata.php | 83 ++----------------- .../single-items-metadata_new.php | 29 +++++++ .../single-items-metadata_old.php | 75 +++++++++++++++++ 4 files changed, 135 insertions(+), 98 deletions(-) create mode 100644 src/template-parts/single-items-metadata_new.php create mode 100644 src/template-parts/single-items-metadata_old.php diff --git a/src/functions/customizer/tainacan-items-page-search-area.php b/src/functions/customizer/tainacan-items-page-search-area.php index 4233e86..3794a6e 100644 --- a/src/functions/customizer/tainacan-items-page-search-area.php +++ b/src/functions/customizer/tainacan-items-page-search-area.php @@ -200,32 +200,34 @@ if ( !function_exists('tainacan_interface_customize_register_tainacan_items_page * * @return array An associative array with view mode options and the default one */ -function tainacan_get_default_view_mode_choices() { - $default_view_mode = ''; - $enabled_view_modes = []; - - if (function_exists('tainacan_get_the_view_modes')) { - $view_modes = tainacan_get_the_view_modes(); - $default_view_mode = $view_modes['default_view_mode']; +if ( !function_exists('tainacan_get_default_view_mode_choices') ) { + function tainacan_get_default_view_mode_choices() { + $default_view_mode = ''; $enabled_view_modes = []; - - foreach ($view_modes['registered_view_modes'] as $key => $view_mode) { - if (!$view_mode['full_screen']) - $enabled_view_modes[$key] = $view_mode['label']; + + if (function_exists('tainacan_get_the_view_modes')) { + $view_modes = tainacan_get_the_view_modes(); + $default_view_mode = $view_modes['default_view_mode']; + $enabled_view_modes = []; + + foreach ($view_modes['registered_view_modes'] as $key => $view_mode) { + if (!$view_mode['full_screen']) + $enabled_view_modes[$key] = $view_mode['label']; + } + } else { + $default_view_mode = 'masonry'; + $enabled_view_modes = [ + 'masonry' => __('Masonry', 'tainacan-interface'), + 'cards' => __('Cards', 'tainacan-interface'), + 'table' => __('Table', 'tainacan-interface'), + 'grid' => __('Grid', 'tainacan-interface') + ]; } - } else { - $default_view_mode = 'masonry'; - $enabled_view_modes = [ - 'masonry' => __('Masonry', 'tainacan-interface'), - 'cards' => __('Cards', 'tainacan-interface'), - 'table' => __('Table', 'tainacan-interface'), - 'grid' => __('Grid', 'tainacan-interface') + return [ + 'default_view_mode' => $default_view_mode, + 'enabled_view_modes' => $enabled_view_modes ]; } - return [ - 'default_view_mode' => $default_view_mode, - 'enabled_view_modes' => $enabled_view_modes - ]; } if ( ! function_exists( 'tainacan_sanitize_items_repository_list_default_view_mode' ) ) : diff --git a/src/template-parts/single-items-metadata.php b/src/template-parts/single-items-metadata.php index 4f07fcd..fc105c7 100644 --- a/src/template-parts/single-items-metadata.php +++ b/src/template-parts/single-items-metadata.php @@ -1,76 +1,7 @@ -
- - -

- -

- -
-
-
- -
-
-
-
- -
\ No newline at end of file += 0) { + get_template_part( 'template-parts/single-items-metadata_new' ); + } else { + get_template_part( 'template-parts/single-items-metadata_old' ); + } +?> \ No newline at end of file diff --git a/src/template-parts/single-items-metadata_new.php b/src/template-parts/single-items-metadata_new.php new file mode 100644 index 0000000..38959bb --- /dev/null +++ b/src/template-parts/single-items-metadata_new.php @@ -0,0 +1,29 @@ + true, + 'before_title' => '

', + 'after_title' => '

', + 'before_value' => '

', + 'after_value' => '

', + 'exclude_title' => get_theme_mod('tainacan_single_item_hide_core_title_metadata', false) + ); + $args = array( + 'before' => '
', + 'after' => '
', + 'before_name' => '

', + 'after_name' => '

', + 'before_metadata_list' => do_action( 'tainacan-interface-single-item-metadata-begin' ). ' +
+
+
+ +
+
+
' . do_action( 'tainacan-interface-single-item-metadata-end' ), + 'metadata_list_args' => $metadata_args + ); + + tainacan_the_metadata_sections( $args ); +?> \ No newline at end of file diff --git a/src/template-parts/single-items-metadata_old.php b/src/template-parts/single-items-metadata_old.php new file mode 100644 index 0000000..bf4a3a7 --- /dev/null +++ b/src/template-parts/single-items-metadata_old.php @@ -0,0 +1,75 @@ +
+ + +

+ +

+ +
+
+
+ +
+
+
+
+ +
\ No newline at end of file