Setting up glm-client-info plugin
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 11 Jun 2015 18:02:30 +0000 (14:02 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 11 Jun 2015 18:03:32 +0000 (14:03 -0400)
Now the theme will use the glm-client-info plugin to pull the name and
address data out.
Can be setup in the partial files in parts directory

root/footer.php
root/functions.php
root/parts/client-info-footer.php [new file with mode: 0644]
root/parts/client-info-offcanvas.php [new file with mode: 0644]
root/parts/off-canvas-menu.php
template.js

index e064c9f..d851020 100644 (file)
@@ -3,14 +3,7 @@
                                 <?php dynamic_sidebar('sidebar-f');?>
                             <?php endif;?>
                             <div class="row">
-                                <div id="footer_address" class="row small-centered small-11 medium-6 columns">
-                                    <h2>{%= title %}</h2>
-                                    <span>{%= street %}</span>
-                                    <span class="bullet"> &#8226; </span>
-                                    <span>{%= city %}, {%= state %} {%= zip %}</span>
-                                    <span class="bullet"> &#8226; </span>
-                                    <span>{%= phone %}</span>
-                                </div>
+                                <?php get_template_part('parts/client-info-footer');?>
                             </div>
                         </footer>
                     </main><!--End of main-->
index 9765bde..de3c741 100644 (file)
@@ -78,6 +78,29 @@ function glm_page_menu($parent = 0, $class = '')
     echo '</ul><!-- end -->'."\n";
 }
 
+/**
+ * Return the client info option for the given key
+ *
+ * @param type $name Name of the client info option to return
+ *
+ * @return string Option
+ */
+if (!function_exists('glm_get_clientinfo_option')) {
+    function glm_get_clientinfo_option($name)
+    {
+        $settings = get_option('glmclientinfo_settings');
+        $states   = get_option('glmclientinfo_states');
+        if ($name == 'stateFull' && $settings['state']) {
+            return $states[$settings['state']];
+        }
+        if ($name == 'state2Full' && $settings['state2']) {
+            return $states[$settings['state2']];
+        }
+        return ($settings && $settings[$name])
+            ? $settings[$name]
+            : null;
+    }
+}
 
 function SearchFilter($query) {
     if(isset($_GET['searchType'])) {
@@ -173,7 +196,7 @@ function glm_side_menu() {
     } else {
         $ID = $parent->ID;
     }
-    echo '<h1>'.get_the_title($ID).'</h1>';    
+    echo '<h1>'.get_the_title($ID).'</h1>';
     echo '<ul class="sidebar"><!-- begin -->'."\n";
     echo wp_list_pages( 'child_of='.$ID.'&title_li=&depth=1&echo=0');
     echo '</ul><!-- end -->'."\n";
diff --git a/root/parts/client-info-footer.php b/root/parts/client-info-footer.php
new file mode 100644 (file)
index 0000000..12e0e5c
--- /dev/null
@@ -0,0 +1,28 @@
+<div id="footer_address" class="row small-centered small-11 medium-6 columns">
+    <?php if (function_exists('glm_get_clientinfo_option')) :?>
+    <h2><?php echo glm_get_clientinfo_option('businessName');?></h2>
+    <?php if (glm_get_clientinfo_option('address')):?>
+        <span><?php echo glm_get_clientinfo_option('address');?></span>
+        <span class="bullet"> &#8226; </span>
+        <span><?php echo glm_get_clientinfo_option('city');?>, <?php echo glm_get_clientinfo_option('state');?>
+            <?php echo glm_get_clientinfo_option('zip');?></span>
+    <?php endif;?>
+    <?php if (glm_get_clientinfo_option('address2')):?>
+        <span class="bullet"> &#8226; </span>
+        <span><?php echo glm_get_clientinfo_option('address2');?></span>
+        <span class="bullet"> &#8226; </span>
+        <span><?php echo glm_get_clientinfo_option('city2');?>, <?php echo glm_get_clientinfo_option('state2');?>
+            <?php echo glm_get_clientinfo_option('zip2');?></span>
+    <?php endif;?>
+    <?php if (glm_get_clientinfo_option('phone')) :?>
+        <span class="bullet"> &#8226; </span><span><?php echo glm_get_clientinfo_option('phone');?></span>
+    <?php endif;?>
+    <?php if (glm_get_clientinfo_option('fax')) :?>
+        <span class="bullet"> &#8226; </span><span><?php echo glm_get_clientinfo_option('fax');?></span>
+    <?php endif;?>
+    <?php if (glm_get_clientinfo_option('extra')) :?>
+        <span class="bullet"> &#8226; </span><span><?php echo glm_get_clientinfo_option('extra');?></span>
+    <?php endif;?>
+    <?php endif;?>
+</div>
+
diff --git a/root/parts/client-info-offcanvas.php b/root/parts/client-info-offcanvas.php
new file mode 100644 (file)
index 0000000..24a6987
--- /dev/null
@@ -0,0 +1,24 @@
+<?php if (function_exists('glm_get_clientinfo_option')) :?>
+<ul>
+    <li><?php echo glm_get_clientinfo_option('businessName');?></li>
+    <?php if (glm_get_clientinfo_option('address')):?>
+        <li><?php echo glm_get_clientinfo_option('address');?></li>
+        <li><?php echo glm_get_clientinfo_option('city');?>, <?php echo glm_get_clientinfo_option('state');?>
+            <?php echo glm_get_clientinfo_option('zip');?></li>
+    <?php endif;?>
+    <?php if (glm_get_clientinfo_option('address2')):?>
+        <li><?php echo glm_get_clientinfo_option('address2');?></li>
+        <li><?php echo glm_get_clientinfo_option('city2');?>, <?php echo glm_get_clientinfo_option('state2');?>
+            <?php echo glm_get_clientinfo_option('zip2');?></li>
+    <?php endif;?>
+    <?php if (glm_get_clientinfo_option('phone')) :?>
+        <li><?php echo glm_get_clientinfo_option('phone');?></li>
+    <?php endif;?>
+    <?php if (glm_get_clientinfo_option('fax')) :?>
+        <li><?php echo glm_get_clientinfo_option('fax');?></li>
+    <?php endif;?>
+    <?php if (glm_get_clientinfo_option('extra')) :?>
+        <li><?php echo glm_get_clientinfo_option('extra');?></li>
+    <?php endif;?>
+</ul>
+<?php endif;?>
index 82fba5c..c9f9451 100644 (file)
@@ -1,3 +1,4 @@
 <aside class="left-off-canvas-menu hide-for-large-up">
     <?php glm_offcanvas_menu(); ?>
+    <?php get_template_part('parts/client-info-offcanvas');?>
 </aside>
index 80b0be5..a0e685c 100644 (file)
@@ -1,11 +1,3 @@
-/***
- * Excerpted from "Automate with Grunt",
- * published by The Pragmatic Bookshelf.
- * Copyrights apply to this code. It may not be used to create training material, 
- * courses, books, articles, and the like. Contact us if you are in doubt.
- * We make no guarantees that this code is fit for any purpose. 
- * Visit http://www.pragmaticprogrammer.com/titles/bhgrunt for more book information.
-***/
 exports.description = 'Creates Foundation template with SASS';
 
 exports.notes = 'This project includes a default JavaScript and CSS file';
@@ -15,21 +7,15 @@ exports.warnOn = '*';
 exports.template = function(grunt, init, done) {
   init.process({}, [
     // input prompts go here
-    
+
     // Prompt for these values.
     init.prompt('name'  , 'ProjectNameNoSpaces'),
-    init.prompt('title', 'Site Name'),
-    init.prompt('street', 'Street'),
-    init.prompt('city', 'City'),
-    init.prompt('state', 'State'),
-    init.prompt('zip', 'ZIP'),
-    init.prompt('phone', 'Phone Number'),
   ], function(err, props) {
     // processing section
 
     var files = init.filesToCopy(props);
-    init.copyAndProcess(files, props); 
-    
+    init.copyAndProcess(files, props);
+
     init.writePackageJSON('package.json', {
        name: props.name,
        description: "Gaslight Media",