Plugin Directory

Changeset 3105518


Ignore:
Timestamp:
06/21/2024 08:00:03 AM (20 months ago)
Author:
contractorcommerce
Message:

Add checkox

Location:
contractor-commerce-integration/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • contractor-commerce-integration/trunk/admin/partials/contractor-commerce-admin-settings.php

    r3043047 r3105518  
    5757        'pluginPage',
    5858        'concom_pluginPage_section'
    59     );}
     59    );
     60
     61    add_settings_field(
     62        'not_place_in_head',
     63        __("Limit script tag to single page (not placed in <head>)", 'concom'),
     64        'not_place_in_head_render',
     65        'pluginPage',
     66        'concom_pluginPage_section',
     67    );
     68}
    6069
    6170function concom_text_field_0_render(  ) {
     
    94103}
    95104
     105function not_place_in_head_render() {
     106    $options = get_option( 'concom_settings' );
     107
     108    $checked = isset($options['not_place_in_head']) && $options['not_place_in_head'];
     109
     110    echo '<input type="checkbox" id="not_place_in_head" name="concom_settings[not_place_in_head]" value="1"' . checked( 1, $checked, false ) . '/>';
     111}
    96112
    97113function concom_settings_section_callback(  ) {
  • contractor-commerce-integration/trunk/public/class-contractor-commerce-public.php

    r3097295 r3105518  
    113113            }
    114114
     115            if (isset(get_option( 'concom_settings' )['not_place_in_head']) ) {
     116                return '<div id="concom-shop" ' . $historyMode . '></div><script async defer src="https://plugin.contractorcommerce.com?key=' . $options['concom_text_field_0'] . '"></script>';
     117            }
     118
    115119            return '<div id="concom-shop" ' . $historyMode . '></div>';
    116120        }
     
    122126        $options = get_option( 'concom_settings' );
    123127
     128        if (isset(get_option( 'concom_settings' )['not_place_in_head']) ) {
     129            return;
     130        }
     131
    124132        if (get_the_ID() == $options['concom_select_field_1'] ) {
    125133            echo '<script async defer src="https://plugin.contractorcommerce.com?key=' . $options['concom_text_field_0'] . '"></script>';
Note: See TracChangeset for help on using the changeset viewer.