Plugin Directory

Changeset 1244509


Ignore:
Timestamp:
09/13/2015 12:32:30 PM (11 years ago)
Author:
White Bracket
Message:

Added the ability for universal Google Analytics to be added the every page across the website and removed the !important statement from the generated CSS

Location:
white-bracket-theme-options
Files:
13 added
6 edited

Legend:

Unmodified
Added
Removed
  • white-bracket-theme-options/trunk/admin/admin.php

    r1228137 r1244509  
    6262                echo '});';
    6363            echo '</script>';
     64        elseif( isset($_POST["save-analytics"]) ):
     65                $account_number = $_POST["google-analytics"];
     66                update_option( 'white-bracket-google-analytics', $account_number );
     67                $options_updated = 'yes';
    6468        endif;
    6569    endif;
     
    8185            echo '<div class="wb-tab active" id="wb-content-tab">Content</div>';
    8286            echo '<div class="wb-tab" id="wb-settings-tab">Settings</div>';
     87            echo '<div class="wb-tab" id="wb-analytics-tab">Google Analytics</div>';
    8388            echo '<div class="wb-tab" id="wb-documentation-tab">Documentation</div>';
    8489        echo '</div>';
     
    116121            echo '<h3>Settings</h3>';
    117122            get_current_white_bracket_settings();
     123        echo '</div>';
     124        echo '<div class="wb-analytics">';
     125            echo '<h3>Google Analytics</h3>';
     126            get_white_bracket_analytics();
    118127        echo '</div>';
    119128        echo '<div class="wb-documentation">';
     
    228237}
    229238
     239function get_white_bracket_analytics(){
     240
     241    $value = "";
     242    $value = get_option('white-bracket-google-analytics');
     243
     244    $output = '<h4>Google Analytics Account Number</h4>';
     245    $output .= '<form action="'.$_SERVER["REQUEST_URI"].'" method="post">';
     246    $output .= '<p><input type="text" name="google-analytics" value="'.$value.'" placeholder="UA-12345678-1" /></p>';
     247    $output .= '<input class="button button-primary button-large" type="submit" name="save-analytics" value="Save Analytics" />';
     248    $output .= '</form>';
     249
     250    echo $output;
     251}
     252
    230253function get_white_bracket_documntation(){
    231254
     
    236259    $output .= '<p>[wbo option_name="wb_XXXX" wpautop="no"]</p>';
    237260
     261    $output .= '<h4>Google Analytics</h4>';
     262    $output .= '<p>To add Google Analytics to your website, simply enter your account number into the input field and click save. Your Google Analytics account number will look something like UA-12345678-1. This will insert the universal analytics onto everypage on your website.</p>';
     263
    238264    echo $output;
    239265}
  • white-bracket-theme-options/trunk/css/white-bracket-theme-options.css

    r1228137 r1244509  
    3131    font-weight: bold;
    3232}
    33 .wb-content, .wb-settings, .wb-documentation{
     33.wb-content, .wb-settings, .wb-documentation, .wb-analytics{
    3434    width:100%;
    3535    padding:10px 20px;
     
    4141    box-sizing: border-box;
    4242}
    43 .wb-settings, .wb-documentation{
     43.wb-settings, .wb-documentation, .wb-analytics{
    4444    display:none;
    4545}
  • white-bracket-theme-options/trunk/js/white-bracket-theme-options.js

    r1228137 r1244509  
    3434        $('.wb-content').slideUp();
    3535        $('.wb-settings').delay(500).slideDown();
     36        $('.wb-analytics').slideUp();
    3637        $('.wb-documentation').slideUp();
    3738        $('#wb-settings-tab').addClass('active');
    3839        $('#wb-content-tab').removeClass('active');
     40        $('#wb-analytics-tab').removeClass('active');
    3941        $('#wb-documentation-tab').removeClass('active');
    4042    });
     
    4244        $('.wb-settings').slideUp();
    4345        $('.wb-content').delay(500).slideDown();
     46        $('.wb-analytics').slideUp();
    4447        $('.wb-documentation').slideUp();
    4548        $('#wb-content-tab').addClass('active');
     49        $('#wb-analytics-tab').removeClass('active');
     50        $('#wb-settings-tab').removeClass('active');
     51        $('#wb-documentation-tab').removeClass('active');
     52    });
     53    $('#wb-analytics-tab').click(function(){
     54        $('.wb-settings').slideUp();
     55        $('.wb-content').slideUp();
     56        $('.wb-analytics').delay(500).slideDown();
     57        $('.wb-documentation').slideUp();
     58        $('#wb-content-tab').removeClass('active');
     59        $('#wb-analytics-tab').addClass('active');
    4660        $('#wb-settings-tab').removeClass('active');
    4761        $('#wb-documentation-tab').removeClass('active');
     
    5064        $('.wb-settings').slideUp();
    5165        $('.wb-content').slideUp();
     66        $('.wb-analytics').slideUp();
    5267        $('.wb-documentation').delay(500).slideDown();
    5368        $('#wb-content-tab').removeClass('active');
     69        $('#wb-analytics-tab').removeClass('active');
    5470        $('#wb-settings-tab').removeClass('active');
    5571        $('#wb-documentation-tab').addClass('active');
  • white-bracket-theme-options/trunk/readme.txt

    r1230794 r1244509  
    11=== White Bracket Theme Options ===
    22Contributors: White Bracket
    3 Tags: global content, theme options, more wysiwyg editors, heading tags styling, tag styling
     3Tags: global content, theme options, more wysiwyg editors, google analytics, universal analytics, universal google analytics
    44Requires at least: 3.5
    55Tested up to: 4.3
    66
    77== Description ==
    8 White Bracket Theme Options lets you create global content/global options that you can then add to any page or post via shortcode. The shortcode is generated as soon as you save your content. As well as creating additional content, you can set the font size and font colour of heading tags (h1 through to h6), p tags, a tags and li tags.
     8White Bracket Theme Options lets you create global content/global options that you can then add to any page or post via shortcode. The shortcode is generated as soon as you save your content. As well as creating additional content, you can set the font size and font colour of heading tags (h1 through to h6), p tags, a tags and li tags. The latest addition to the plugin is the ability to add the latest Google Analytics code to every page on your website.
    99
    1010This plugin is perfect for you, if you want content to appear in multiple places across your site, such as telephone numbers, email addresses and images. Edit the content in one place, and it changes everywhere you have used the generated shortcode.
     
    3232
    3333== Frequently Asked Questions ==
    34 Q: Is it possible to remove p tags from the shortcode output?
    35 a: Yes, just add wpautop="no" e.g. [wbo option_name="wb_XXXX" wpautop="no"]
     34= Q: Is it possible to remove p tags from the shortcode output? =
     35A: Yes, just add wpautop="no" e.g. [wbo option_name="wb_XXXX" wpautop="no"]
    3636
    3737== Screenshots ==
     
    42425. Settings tab
    43436. Editing H1 settings
     447. Google Analytics
    4445
    4546== Changelog ==
     47
     48= 1.3.2 =
     49* Added the ability to add Google Analytics to every page on a website.
     50* Removed the !important statement off the generated css as it was being applied to items such as menu items, which is not the intention. The main idea is the adjust the site content.
    4651
    4752= 1.3.1 =
  • white-bracket-theme-options/trunk/white-bracket-functions.php

    r1230794 r1244509  
    3636    $li_settings = get_option('white_bracket_setting_li');
    3737
    38     $output = '<!-- ADDED BY WHITE BRACKET THEME OPTIONS START -->'.PHP_EOL;
     38    $output = '<!-- ADDED BY WHITE BRACKET THEME OPTIONS -->'.PHP_EOL;
    3939    $output .= '<style type="text/css">'.PHP_EOL;
    4040        if($h1_settings):
     
    6666        endif;
    6767    $output .= '</style>'.PHP_EOL;
    68     $output .= '<!-- ADDED BY WHITE BRACKET THEME OPTIONS END -->'.PHP_EOL;
     68    $output .= '<!-- ADDED BY WHITE BRACKET THEME OPTIONS -->'.PHP_EOL;
    6969
    7070    if( $output != '<!-- ADDED BY WHITE BRACKET THEME OPTIONS --><style type="text/css"></style><!-- ADDED BY WHITE BRACKET THEME OPTIONS -->' ):
     
    8181        $font_size = $value["font-size"];
    8282        if( stripos($font_size, 'px') > 0 ):
    83             $output = $tag.'{font-size:'.$value["font-size"].' !important; color:'.$value["colour"].' !important;}'.PHP_EOL;
     83            $output = $tag.'{font-size:'.$value["font-size"].'; color:'.$value["colour"].';}'.PHP_EOL;
    8484        else:
    85             $output = $tag.'{font-size:'.$value["font-size"].'px !important; color:'.$value["colour"].' !important;}'.PHP_EOL;
     85            $output = $tag.'{font-size:'.$value["font-size"].'px; color:'.$value["colour"].';}'.PHP_EOL;
    8686        endif;
    8787    else:
     
    9191    return $output;
    9292}
     93
     94function add_white_bracket_google_analytics(){
     95
     96    $google_analytics = get_option('white-bracket-google-analytics');
     97
     98    $output = '<!-- ADDED BY WHITE BRACKET THEME OPTIONS -->'.PHP_EOL;
     99    $output .= "<script>".PHP_EOL;;
     100        $output .= "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){".PHP_EOL;
     101        $output .= "(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),".PHP_EOL;
     102        $output .= "m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)".PHP_EOL;
     103        $output .= "})(window,document,'script','//www.google-analytics.com/analytics.js','ga');".PHP_EOL;
     104        $output .= "".PHP_EOL;
     105        $output .= "ga('create', '".$google_analytics."', 'auto');".PHP_EOL;
     106        $output .= "ga('send', 'pageview');".PHP_EOL;
     107    $output .= "</script>".PHP_EOL;
     108    $output .= '<!-- ADDED BY WHITE BRACKET THEME OPTIONS -->'.PHP_EOL;
     109
     110    echo $output;
     111}
     112$google_analytics = get_option('white-bracket-google-analytics');
     113if($google_analytics):
     114    add_action('wp_head','add_white_bracket_google_analytics');
     115endif;
  • white-bracket-theme-options/trunk/white-bracket-theme-options.php

    r1230794 r1244509  
    44 * Plugin Name: White Bracket Theme Options
    55 * Plugin URI:
    6  * Description: Lets you create global content/global options. Perfect for creating content to appear in multiple places around the site, and edit it in one place.
    7  * Version: 1.3.1
     6 * Description: Create content to appear in multiple places around your site and edit in one place. Add universal Google Analytics. Adjust text colours and size.
     7 * Version: 1.3.2
    88 * Author: White Bracket
    99 * Author URI: http://www.white-bracket.co.uk
Note: See TracChangeset for help on using the changeset viewer.