Plugin Directory

Changeset 3097295


Ignore:
Timestamp:
06/04/2024 10:24:42 AM (21 months ago)
Author:
contractorcommerce
Message:

Move script to the head

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

Legend:

Unmodified
Added
Removed
  • contractor-commerce-integration/trunk/README.txt

    r3043047 r3097295  
    44Requires at least: 3.0.1
    55Tested up to: 6.3
    6 Stable tag: 1.1.2
     6Stable tag: 1.1.3
    77Requires PHP: 7.0
    88License: GPLv2 or later
  • contractor-commerce-integration/trunk/contractor-commerce.php

    r3043047 r3097295  
    1717 * Plugin URI:        https://bitbucket.org/hvactechnologies/contractor-commerce-integration
    1818 * Description:       Adds Contractor Commerce to your site.
    19  * Version:           1.1.2
     19 * Version:           1.1.3
    2020 * Author:            Contractor Commerce
    2121 * Author URI:        https://www.contractorcommerce.com/
     
    3838 * Rename this for your plugin and update it as you release new versions.
    3939 */
    40 define( 'CONTRACTOR_COMMERCE_VERSION', '1.1.2' );
     40define( 'CONTRACTOR_COMMERCE_VERSION', '1.1.3' );
    4141
    4242/**
  • contractor-commerce-integration/trunk/includes/class-contractor-commerce.php

    r3043047 r3097295  
    7171            $this->version = CONTRACTOR_COMMERCE_VERSION;
    7272        } else {
    73             $this->version = '1.1.2';
     73            $this->version = '1.1.3';
    7474        }
    7575        $this->plugin_name = 'contractor-commerce';
     
    176176        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
    177177        $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
     178        $this->loader->add_action( 'wp_head', $plugin_public, 'concom_script' );
    178179       
    179180        $this->loader->add_filter( 'the_content', $plugin_public, 'content_filter', 1 );
  • contractor-commerce-integration/trunk/public/class-contractor-commerce-public.php

    r3040296 r3097295  
    100100
    101101    }
    102      
    103     public function content_filter( $content ) {
    104         $options = get_option( 'concom_settings' );
    105        
    106         if ( get_the_ID() == $options['concom_select_field_1'] ) {
    107             $page_name = get_page_uri();
    108            
    109             $historyMode = '';
    110            
    111             if (isset(get_option( 'concom_settings' )['concom_seo_checkbox']) ) {
    112                 $historyMode .= 'history-mode="' . $page_name . '"';
    113             }
    114            
    115             return '<div id="concom-shop" ' . $historyMode . '></div><script async defer src="https://plugin.contractorcommerce.com?key=' . $options['concom_text_field_0'] . '"></script>';
    116         }
    117      
    118         return $content;
    119     }
    120102
     103    public function content_filter( $content ) {
     104        $options = get_option( 'concom_settings' );
     105
     106        if ( get_the_ID() == $options['concom_select_field_1'] ) {
     107            $page_name = get_page_uri();
     108
     109            $historyMode = '';
     110
     111            if (isset(get_option( 'concom_settings' )['concom_seo_checkbox']) ) {
     112                $historyMode .= 'history-mode="' . $page_name . '"';
     113            }
     114
     115            return '<div id="concom-shop" ' . $historyMode . '></div>';
     116        }
     117
     118        return $content;
     119    }
     120
     121    public function concom_script() {
     122        $options = get_option( 'concom_settings' );
     123
     124        if (get_the_ID() == $options['concom_select_field_1'] ) {
     125            echo '<script async defer src="https://plugin.contractorcommerce.com?key=' . $options['concom_text_field_0'] . '"></script>';
     126        }
     127    }
    121128}
Note: See TracChangeset for help on using the changeset viewer.