adding social media view file, adding font awesome support
authorAnthony Talarico <talarico@gaslightmedia.com>
Sun, 20 Oct 2019 00:32:10 +0000 (20:32 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Sun, 20 Oct 2019 00:32:10 +0000 (20:32 -0400)
controllers/Admin.php
controllers/Front.php
views/footer.php
views/social-media.php [new file with mode: 0644]

index d1cae88..1027108 100644 (file)
@@ -312,6 +312,31 @@ class Glmclientinfo_Admin_Controller
                 'label' => 'Extra Content',
                 'type'  => 'textarea'
             ),
+            array(
+                'name'  => 'facebook',
+                'label' => 'Facebook',
+                'type'  => 'text'
+            ),
+            array(
+                'name'  => 'twitter',
+                'label' => 'Twitter',
+                'type'  => 'text'
+            ),
+            array(
+                'name'  => 'instagram',
+                'label' => 'Instagram',
+                'type'  => 'text'
+            ),
+            array(
+                'name'  => 'youtube',
+                'label' => 'Youtube',
+                'type'  => 'text'
+            ),
+            array(
+                'name'  => 'pinterest',
+                'label' => 'Pinterest',
+                'type'  => 'text'
+            ),
         );
         $fieldNames2 = array(
             array(
@@ -413,7 +438,7 @@ class Glmclientinfo_Admin_Controller
         $states  = get_option(GLM_CLEINTINFO_STATES);
         include $this->path . 'views/stateSelect.php';
     }
-
+    
     public function glmclientinfo_settings_section_callback()
     {
 //        echo __('Business Name, Address and phone numbers', 'wordpress');
@@ -436,6 +461,7 @@ class Glmclientinfo_Admin_Controller
     public function load_stylesheet()
     {
         wp_enqueue_style('client-admin-css',plugins_url('glm-client-info/css/admin/admin.css' , $this->pluginDirName));
+        wp_enqueue_style("glm-fontawesome", "https://use.fontawesome.com/releases/v5.5.0/css/all.css");
     }
     public function load_script()
     {
@@ -447,6 +473,5 @@ class Glmclientinfo_Admin_Controller
             'all'
         );
         wp_enqueue_script('client-info-admin-js');
-
     }
 }
index 5cff1a7..d12849f 100644 (file)
@@ -46,6 +46,7 @@ class Glmclientinfo_Front_controller
     {
         $this->path = $path;
         add_action('widgets_init', array($this, 'glmclientinfo_register_widget'));
+        add_action('wp_enqueue_scripts', array($this, 'load_script'));
     }
 
     /**
@@ -56,5 +57,8 @@ class Glmclientinfo_Front_controller
         include $this->path . 'models/Glmclientinfo_Widget.php';
         register_widget('Glmclientinfo_Widget');
     }
-
+    public function load_script()
+    {
+        wp_enqueue_style("glm-fontawesome", "https://use.fontawesome.com/releases/v5.5.0/css/all.css");
+    }
 }
index 98afe60..a259f99 100644 (file)
@@ -1,7 +1,8 @@
 <div class="glm-footer-client-info">
+    <?php $exclude = array("facebook", "twitter", "instagram", "pinterest", "youtube"); ?>
     <?php foreach( get_option('glmclientinfo_settings') as $setting => $value){ ?>
             <div class="glm-client-info-field glm-client-info-<?php echo $setting; ?>">
-                <?php if( $value !== '') { ?>
+                <?php if( $value !== '' && ! in_array($setting, $exclude) ) { ?>
                         <div class="glm-client-info-name" ><?php echo $setting; ?>:</div>
                     <?php if( $setting === "phone" || $setting === "tollfree"){ ?>
                         <a href="tel:<?php echo str_replace(array('.', ',','-'), '' , $value); ?>"><?php echo $value; ?></a>
diff --git a/views/social-media.php b/views/social-media.php
new file mode 100644 (file)
index 0000000..b9460f3
--- /dev/null
@@ -0,0 +1,21 @@
+<div class="glm-footer-client-info">
+    <?php 
+        $options = get_option('glmclientinfo_settings'); 
+        $social_media_settings = array(
+            "facebook"  => $options['facebook'],
+            "instagram" => $options['instagram'],
+            'twitter'   => $options['twitter'],
+            'pinterest' => $options['pinterest'],
+            "youtube"   => $options['youtube'],
+
+        );
+    ?>
+    <?php foreach( $social_media_settings as $setting => $value){ ?>
+            <div class="glm-client-info-field glm-client-info-<?php echo $setting; ?>">
+                <?php if( $value !== '') { ?>
+                        <div class="glm-client-info-name" ><?php echo $setting; ?>:</div>
+                        <div class="glm-client-info-value"><a href="<?php echo $value;?>"><i class="fab fa-<?php echo $setting; ?>"></i></a></div>
+                <?php } ?>
+            </div>
+      <?php } ?>
+</div>
\ No newline at end of file