Adds filter to remove some custom post types from the list and tests adding custom options to tainacan templates.

This commit is contained in:
mateuswetah 2020-09-15 23:15:40 -03:00
parent 3b8116a87d
commit 34ae1d907a
8 changed files with 114 additions and 5 deletions

View File

@ -143,3 +143,51 @@ function blocksy_tainacan_get_source_item_list_url() {
return tainacan_the_collection_url() . '?' . http_build_query(array_merge($args));
}
}
/**
* Adds extra customizer options to items single page template
*/
function blocksy_tainacan_custom_post_types_single_options( $options, $post_type, $post_type_object ) {
if ( defined ('TAINACAN_VERSION') ) {
$collections_post_types = \Tainacan\Repositories\Repository::get_collections_db_identifiers();
if ( in_array($post_type, $collections_post_types) ) {
$options['title'] = sprintf(
__('Item from %s', 'blocksy-tainacan'),
$post_type_object->labels->name
);
$item_extra_options = blocksy_get_options(get_stylesheet_directory() . '/inc/options/posts/tainacan-item-single.php', [
'post_type' => $post_type_object,
'is_general_cpt' => true
], false);
if ( is_array($item_extra_options) ) {
$options['options'] = array_merge(
$options['options'],
$item_extra_options
);
}
}
}
return $options;
}
add_filter( 'blocksy:custom_post_types:single-options', 'blocksy_tainacan_custom_post_types_single_options', 10, 3 );
/**
* Removes tainacan metadatum and filters from the custom metadata options in the customizer controller.
*/
function blocksy_tainacan_custom_post_types_supported_list( $potential_post_types ) {
if ( defined ('TAINACAN_VERSION') ) {
return array_filter( $potential_post_types, function($post_type) {
return !in_array($post_type, [ 'tainacan-metadatum', 'tainacan-filter' ]);
});
}
return $potential_post_types;
}
add_filter( 'blocksy:custom_post_types:supported_list', 'blocksy_tainacan_custom_post_types_supported_list', 10 );

View File

@ -0,0 +1,15 @@
<?php
if (! isset($is_general_cpt)) {
$is_general_cpt = false;
}
if (! isset($is_bbpress)) {
$is_bbpress = false;
}
$options =
blocksy_get_options(get_stylesheet_directory() . '/inc/options/single-elements/title-metadata.php', [
'prefix' => $post_type->name . '_single',
'enabled' => 'yes'
], false);

View File

@ -0,0 +1,24 @@
<?php
if (! isset($prefix)) {
$prefix = '';
} else {
$prefix = $prefix . '_';
}
if (! isset($enabled)) {
$enabled = 'yes';
}
$options = [
$prefix . 'has_title_metadata' => [
'label' => __( 'Title metadata in the metadata list.', 'blocksy-tainacan' ),
'type' => 'ct-panel',
'switch' => true,
'value' => $enabled,
'sync' => blocksy_sync_single_post_container([
'prefix' => $prefix
])
],
];

View File

@ -6,6 +6,17 @@
* Text Domain: blocksy-tainacan
*/
/* Tainacan Gutenberg Blocks colors */
:root {
--tainacan-block-primary: var(--paletteColor1, #3eaf7c);
--tainacan-block-gray0: var(--backgroundColor, #f8f9fb);
--tainacan-block-gray1: var(--backgroundColor, #f8f9fb);
--tainacan-block-gray2: var(--formBorderInitialColor, #e0e5eb);
--tainacan-block-gray3: var(--formBorderInitialColor, #e0e5eb);
--tainacan-block-gray4: var(--color, rgba(44, 62, 80, 0.9));
--tainacan-block-gray5: var(--headingColor, rgba(44, 62, 80, 1));
}
/* Tainacan Items list customization */
.theme-items-list {
--tainacan-font-family: var(--fontFamily, inherit);

View File

@ -5,6 +5,17 @@
* Template: blocksy
* Text Domain: blocksy-tainacan
*/
/* Tainacan Gutenberg Blocks colors */
:root {
--tainacan-block-primary: var(--paletteColor1, #3eaf7c);
--tainacan-block-gray0: var(--backgroundColor, #f8f9fb);
--tainacan-block-gray1: var(--backgroundColor, #f8f9fb);
--tainacan-block-gray2: var(--formBorderInitialColor, #e0e5eb);
--tainacan-block-gray3: var(--formBorderInitialColor, #e0e5eb);
--tainacan-block-gray4: var(--color, rgba(44, 62, 80, 0.9));
--tainacan-block-gray5: var(--headingColor, rgba(44, 62, 80, 1));
}
/* Tainacan Items list customization */
.theme-items-list {
--tainacan-font-family: var(--fontFamily, inherit);

File diff suppressed because one or more lines are too long

2
style.min.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long