Does not display search options when Tainacan plugin is not enabled.

This commit is contained in:
mateuswetah 2020-08-18 16:27:59 -03:00
parent 0f09bb4ecf
commit 28963040a7
1 changed files with 124 additions and 122 deletions

View File

@ -127,143 +127,145 @@ function tainacan_customize_register( $wp_customize ) {
'section' => 'tainacan_header_search',
'label' => __( 'Hide search icon and input', 'tainacan-interface' )
) );
/**
* Adds option to configure the Global search option label.
*/
$wp_customize->add_setting( 'tainacan_search_global_label', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => __( 'Global', 'tainacan-interface' ),
'sanitize_callback' => 'sanitize_text_field'
if (defined ( 'TAINACAN_VERSION' ) ) {
/**
* Adds option to configure the Global search option label.
*/
$wp_customize->add_setting( 'tainacan_search_global_label', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => __( 'Global', 'tainacan-interface' ),
'sanitize_callback' => 'sanitize_text_field'
) );
$wp_customize->add_control( 'tainacan_search_global_label', array(
'type' => 'text',
'settings' => 'tainacan_search_global_label',
'section' => 'tainacan_header_search',
'label' => __( 'Label for "Global" search option', 'tainacan-interface' ),
'description' => __( 'The Global search is the default. Its option will only be visible if at least one of the bellow are selected.')
) );
// Option to search directly on repository items list
$wp_customize->add_setting( 'tainacan_search_on_items', array(
'type' => 'theme_mod',
'default' => false,
'capability' => 'edit_theme_options',
'sanitize_callback' => 'tainacan_callback_sanitize_checkbox',
) );
$wp_customize->add_control( 'tainacan_search_global_label', array(
'type' => 'text',
'settings' => 'tainacan_search_global_label',
'section' => 'tainacan_header_search',
'label' => __( 'Label for "Global" search option', 'tainacan-interface' ),
'description' => __( 'The Global search is the default. Its option will only be visible if at least one of the bellow are selected.')
$wp_customize->add_control( 'tainacan_search_on_items', array(
'type' => 'checkbox',
'settings' => 'tainacan_search_on_items',
'section' => 'tainacan_header_search',
'label' => __( 'Display option to search on tainacan items repository list', 'tainacan-interface' )
) );
// Option to search directly on repository items list
$wp_customize->add_setting( 'tainacan_search_on_items', array(
'type' => 'theme_mod',
'default' => false,
'capability' => 'edit_theme_options',
'sanitize_callback' => 'tainacan_callback_sanitize_checkbox',
) );
$wp_customize->add_control( 'tainacan_search_on_items', array(
'type' => 'checkbox',
'settings' => 'tainacan_search_on_items',
'section' => 'tainacan_header_search',
'label' => __( 'Display option to search on tainacan items repository list', 'tainacan-interface' )
) );
/**
* Adds option to configure the Items search option label.
*/
$wp_customize->add_setting( 'tainacan_search_on_items_label', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => __( 'Items', 'tainacan-interface' ),
'sanitize_callback' => 'sanitize_text_field'
) );
$wp_customize->add_control( 'tainacan_search_on_items_label', array(
'type' => 'text',
'settings' => 'tainacan_search_on_items_label',
'section' => 'tainacan_header_search',
'label' => __( 'Label for the "items" search option', 'tainacan-interface' )
) );
/**
* Adds option to configure the Items search option label.
*/
$wp_customize->add_setting( 'tainacan_search_on_items_label', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => __( 'Items', 'tainacan-interface' ),
'sanitize_callback' => 'sanitize_text_field'
// Option to search directly on collections list
$wp_customize->add_setting( 'tainacan_search_on_collections', array(
'type' => 'theme_mod',
'default' => false,
'capability' => 'edit_theme_options',
'sanitize_callback' => 'tainacan_callback_sanitize_checkbox',
) );
$wp_customize->add_control( 'tainacan_search_on_items_label', array(
'type' => 'text',
'settings' => 'tainacan_search_on_items_label',
'section' => 'tainacan_header_search',
'label' => __( 'Label for the "items" search option', 'tainacan-interface' )
$wp_customize->add_control( 'tainacan_search_on_collections', array(
'type' => 'checkbox',
'settings' => 'tainacan_search_on_collections',
'section' => 'tainacan_header_search',
'label' => __( 'Display option to search on tainacan collections list', 'tainacan-interface' )
) );
// Option to search directly on collections list
$wp_customize->add_setting( 'tainacan_search_on_collections', array(
'type' => 'theme_mod',
'default' => false,
'capability' => 'edit_theme_options',
'sanitize_callback' => 'tainacan_callback_sanitize_checkbox',
) );
$wp_customize->add_control( 'tainacan_search_on_collections', array(
'type' => 'checkbox',
'settings' => 'tainacan_search_on_collections',
'section' => 'tainacan_header_search',
'label' => __( 'Display option to search on tainacan collections list', 'tainacan-interface' )
) );
/**
* Adds option to configure the Collections search option label.
*/
$wp_customize->add_setting( 'tainacan_search_on_collections_label', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => __( 'Collections', 'tainacan-interface' ),
'sanitize_callback' => 'sanitize_text_field'
) );
$wp_customize->add_control( 'tainacan_search_on_collections_label', array(
'type' => 'text',
'settings' => 'tainacan_search_on_collections_label',
'section' => 'tainacan_header_search',
'label' => __( 'Label for the "Collections" search option', 'tainacan-interface' )
) );
/**
* Adds option to configure the Collections search option label.
*/
$wp_customize->add_setting( 'tainacan_search_on_collections_label', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => __( 'Collections', 'tainacan-interface' ),
'sanitize_callback' => 'sanitize_text_field'
// Option to search on wordpress posts only
$wp_customize->add_setting( 'tainacan_search_on_posts', array(
'type' => 'theme_mod',
'default' => false,
'capability' => 'edit_theme_options',
'sanitize_callback' => 'tainacan_callback_sanitize_checkbox',
) );
$wp_customize->add_control( 'tainacan_search_on_collections_label', array(
'type' => 'text',
'settings' => 'tainacan_search_on_collections_label',
'section' => 'tainacan_header_search',
'label' => __( 'Label for the "Collections" search option', 'tainacan-interface' )
$wp_customize->add_control( 'tainacan_search_on_posts', array(
'type' => 'checkbox',
'settings' => 'tainacan_search_on_posts',
'section' => 'tainacan_header_search',
'label' => __( 'Display option to search only on WordPress posts', 'tainacan-interface' )
) );
// Option to search on wordpress posts only
$wp_customize->add_setting( 'tainacan_search_on_posts', array(
'type' => 'theme_mod',
'default' => false,
'capability' => 'edit_theme_options',
'sanitize_callback' => 'tainacan_callback_sanitize_checkbox',
) );
$wp_customize->add_control( 'tainacan_search_on_posts', array(
'type' => 'checkbox',
'settings' => 'tainacan_search_on_posts',
'section' => 'tainacan_header_search',
'label' => __( 'Display option to search only on WordPress posts', 'tainacan-interface' )
) );
/**
* Adds option to configure the Posts search option label.
*/
$wp_customize->add_setting( 'tainacan_search_on_posts_label', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => __( 'Posts', 'tainacan-interface' ),
'sanitize_callback' => 'sanitize_text_field'
) );
$wp_customize->add_control( 'tainacan_search_on_posts_label', array(
'type' => 'text',
'settings' => 'tainacan_search_on_posts_label',
'section' => 'tainacan_header_search',
'label' => __( 'Label for the "Posts" search option', 'tainacan-interface' )
) );
/**
* Adds option to configure the Posts search option label.
*/
$wp_customize->add_setting( 'tainacan_search_on_posts_label', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => __( 'Posts', 'tainacan-interface' ),
'sanitize_callback' => 'sanitize_text_field'
// Option to search on wordpress pages only
$wp_customize->add_setting( 'tainacan_search_on_pages', array(
'type' => 'theme_mod',
'default' => false,
'capability' => 'edit_theme_options',
'sanitize_callback' => 'tainacan_callback_sanitize_checkbox',
) );
$wp_customize->add_control( 'tainacan_search_on_posts_label', array(
'type' => 'text',
'settings' => 'tainacan_search_on_posts_label',
'section' => 'tainacan_header_search',
'label' => __( 'Label for the "Posts" search option', 'tainacan-interface' )
$wp_customize->add_control( 'tainacan_search_on_pages', array(
'type' => 'checkbox',
'settings' => 'tainacan_search_on_pages',
'section' => 'tainacan_header_search',
'label' => __( 'Display option to search only on WordPress pages', 'tainacan-interface' )
) );
// Option to search on wordpress pages only
$wp_customize->add_setting( 'tainacan_search_on_pages', array(
'type' => 'theme_mod',
'default' => false,
'capability' => 'edit_theme_options',
'sanitize_callback' => 'tainacan_callback_sanitize_checkbox',
) );
$wp_customize->add_control( 'tainacan_search_on_pages', array(
'type' => 'checkbox',
'settings' => 'tainacan_search_on_pages',
'section' => 'tainacan_header_search',
'label' => __( 'Display option to search only on WordPress pages', 'tainacan-interface' )
) );
/**
* Adds option to configure the Pages search option label.
*/
$wp_customize->add_setting( 'tainacan_search_on_pages_label', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => __( 'Pages', 'tainacan-interface' ),
'sanitize_callback' => 'sanitize_text_field'
) );
$wp_customize->add_control( 'tainacan_search_on_pages_label', array(
'type' => 'text',
'settings' => 'tainacan_search_on_pages_label',
'section' => 'tainacan_header_search',
'label' => __( 'Label for the "Pages" search option', 'tainacan-interface' )
) );
/**
* Adds option to configure the Pages search option label.
*/
$wp_customize->add_setting( 'tainacan_search_on_pages_label', array(
'type' => 'theme_mod',
'capability' => 'edit_theme_options',
'default' => __( 'Pages', 'tainacan-interface' ),
'sanitize_callback' => 'sanitize_text_field'
) );
$wp_customize->add_control( 'tainacan_search_on_pages_label', array(
'type' => 'text',
'settings' => 'tainacan_search_on_pages_label',
'section' => 'tainacan_header_search',
'label' => __( 'Label for the "Pages" search option', 'tainacan-interface' )
) );
}
/**
* Social Share Links