[gnome-web-www: 56/68] Add a section on Customizer for the FoG donation bar



commit 38a60d366bb6dc49cc0b0ab8d0316e563c7ee6a1
Author: Tom Tryfonidis <tomtryf gnome org>
Date:   Thu Jan 12 14:19:57 2017 +0200

    Add a section on Customizer for the FoG donation bar

 theme/header.php         |   12 ++++++++----
 theme/inc/customizer.php |   29 +++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 4 deletions(-)
---
diff --git a/theme/header.php b/theme/header.php
index 701d4cc..ccf51f4 100644
--- a/theme/header.php
+++ b/theme/header.php
@@ -52,11 +52,15 @@ if (function_exists('wppo_get_lang')) {
         </ul>
     </div>
 
-    <!-- Donation ruler for when we run campaigns
-    <script type="text/javascript" src="https://static.gnome.org/friends/ruler/ruler-privacy.js";>  </script>
-    -->
+    <?php /* Donation ruler for when we run campaigns */
+        if( get_theme_mod('show_donation_ruler') == true ) { /* The default value in customizer is false */
+            echo '<div class="donation-ruler-container">'."\n";
+            echo '<script type="text/javascript" 
src="https://static.gnome.org/friends/ruler/ruler-privacy.js";> </script>'."\n";
+            echo '</div>'."\n";
+        }
+    ?>
 
-    <header class="gnome-header">
+    <header class="gnome-header <?php if( get_theme_mod('show_donation_ruler') == true ){ echo 
('visible-fog-ruler'); }?>">
         <nav class="navbar navbar-fixed-top navbar-default affix-top">
             <div class="container">
                 <div class="navbar-header">
diff --git a/theme/inc/customizer.php b/theme/inc/customizer.php
index e0caf75..dd8b002 100644
--- a/theme/inc/customizer.php
+++ b/theme/inc/customizer.php
@@ -8,6 +8,35 @@
 add_action( 'customize_register', 'gnome_grass_options' );
 
 function gnome_grass_options( $wp_customize ) {
+    // Friends of GNOME Panel
+    $wp_customize->add_panel( 'fog_settings', array(
+    'priority'       => 28,
+    'capability'     => 'edit_theme_options',
+    'title'          => 'Friends of GNOME',
+    'description'    => 'Settings for Friends of GNOME pages',
+    ));
+    // Donation Ruler Section
+    $wp_customize->add_section( 'donation_ruler',
+        array(
+            'title' => 'Donation Ruler',
+            'priority' => 94,
+            'panel' => 'fog_settings',
+        )
+    );
+    $wp_customize->add_setting( 'show_donation_ruler',
+        array(
+            'default' => false,
+            'sanitize_callback' => 'grass_sanitize_checkbox',
+        )
+    );
+    $wp_customize->add_control(
+    'show_donation_ruler',
+    array(
+        'section'   => 'donation_ruler',
+        'label'     => 'Check to enable FoG donation ruler',
+        'type'      => 'checkbox'
+         )
+     );
     // Homepage Featured Section
     $wp_customize->add_panel( 'page_home', array(
     'priority'       => 26,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]