Plugin Directory

Changeset 2115213


Ignore:
Timestamp:
07/01/2019 06:17:06 AM (7 years ago)
Author:
bazoio
Message:

1.2 - Add shortcode tags

Location:
bazo
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • bazo

    • Property svn:ignore set to
      .idea
  • bazo/branches/readme.txt

    r2088922 r2115213  
    66Tested up to: 5.2
    77Requires PHP: 5.6
    8 Stable tag: 1.1.5
    9 Version: 1.1.5
     8Stable tag: 1.2
     9Version: 1.2
    1010Contributors: Bazo
    1111
     
    3535
    3636== Changelog ==
     37
     38= 1.2=
     39* Add shortcode [bazo-company name="altText"] to display recognized company.
    3740
    3841= 1.1.5 =
  • bazo/branches/wp-bazo.php

    r2088922 r2115213  
    22    /*
    33      Plugin Name: Bazo
    4       Version: 1.1.5
     4      Version: 1.2
    55      Description: Automatically adds Bazo.io tracker to site
    66      Author: Bazo
     
    146146
    147147
    148 // Add scripts to wp_head()
     148    // Add scripts to wp_head()
    149149    function bazo_header_script() {
    150150        $bazo_options = get_option( 'bazo_options' );
     
    164164                    })(document, 'script', '//c.bazo.io/t.min.js');
    165165                </script>
    166                 <!-- END Bazo Tracker v.1.1.5 -->
     166                <!-- END Bazo Tracker v.1.2 -->
    167167            <?php }
    168168        }
     
    174174
    175175    add_action( 'wp_head', 'bazo_header_script' );
     176
     177
     178    /*  Dodanie shortcode*/
     179
     180
     181    function company_shortcode($atts) {
     182        $altName = shortcode_atts( array(
     183            'name' => ''
     184        ), $atts );
     185        return '<span class="bazo-company">' .$altName['name']. '</span>';
     186    }
     187
     188    add_shortcode( 'bazo-company', 'company_shortcode' );
     189
     190    // Add scripts to wp_footer()
     191    function bazo_footer_script() { ?>
     192        <script>
     193            window.addEventListener('load', function() {
     194                var getBody = document.getElementsByTagName("body")[0];
     195                var company = getBody.getAttribute("bazo-company");
     196                if (!!company) {
     197                    var elems = document.getElementsByClassName('bazo-company');
     198                    for (let i = 0; i < elems.length; ++i) {
     199                        elems[i].innerHTML = company;
     200                    }
     201                }
     202            });
     203        </script>
     204    <?php }
     205
     206    add_action( 'wp_footer', 'bazo_footer_script' );
     207
     208?>
  • bazo/trunk/readme.txt

    r2088922 r2115213  
    66Tested up to: 5.2
    77Requires PHP: 5.6
    8 Stable tag: 1.1.5
    9 Version: 1.1.5
     8Stable tag: 1.2
     9Version: 1.2
    1010Contributors: Bazo
    1111
     
    3535
    3636== Changelog ==
     37
     38= 1.2=
     39* Add shortcode [bazo-company name="altText"] to display recognized company.
    3740
    3841= 1.1.5 =
  • bazo/trunk/wp-bazo.php

    r2088922 r2115213  
    22    /*
    33      Plugin Name: Bazo
    4       Version: 1.1.5
     4      Version: 1.2
    55      Description: Automatically adds Bazo.io tracker to site
    66      Author: Bazo
     
    146146
    147147
    148 // Add scripts to wp_head()
     148    // Add scripts to wp_head()
    149149    function bazo_header_script() {
    150150        $bazo_options = get_option( 'bazo_options' );
     
    164164                    })(document, 'script', '//c.bazo.io/t.min.js');
    165165                </script>
    166                 <!-- END Bazo Tracker v.1.1.5 -->
     166                <!-- END Bazo Tracker v.1.2 -->
    167167            <?php }
    168168        }
     
    174174
    175175    add_action( 'wp_head', 'bazo_header_script' );
     176
     177
     178    /*  Dodanie shortcode*/
     179
     180
     181    function company_shortcode($atts) {
     182        $altName = shortcode_atts( array(
     183            'name' => ''
     184        ), $atts );
     185        return '<span class="bazo-company">' .$altName['name']. '</span>';
     186    }
     187
     188    add_shortcode( 'bazo-company', 'company_shortcode' );
     189
     190    // Add scripts to wp_footer()
     191    function bazo_footer_script() { ?>
     192        <script>
     193            window.addEventListener('load', function() {
     194                var getBody = document.getElementsByTagName("body")[0];
     195                var company = getBody.getAttribute("bazo-company");
     196                if (!!company) {
     197                    var elems = document.getElementsByClassName('bazo-company');
     198                    for (let i = 0; i < elems.length; ++i) {
     199                        elems[i].innerHTML = company;
     200                    }
     201                }
     202            });
     203        </script>
     204    <?php }
     205
     206    add_action( 'wp_footer', 'bazo_footer_script' );
     207
     208?>
Note: See TracChangeset for help on using the changeset viewer.