Update for the employment form
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 15 Jan 2016 21:40:05 +0000 (16:40 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 15 Jan 2016 21:40:05 +0000 (16:40 -0500)
should show sidebar unless your in the employment section
also do not show for events pages

functions.php
index.php

index eff366a..98d1924 100644 (file)
@@ -148,10 +148,10 @@ add_action('thematic_searchloop', 'mytheme_search_loop');
 // End of the Contextual/Highlight Search functions
 
 function is_tree( $pid ) {
-    global $post;              
+    global $post;
 
     if ( is_page($pid) )
-        return true;    
+        return true;
 
     $anc = get_post_ancestors( $post->ID );
     foreach ( $anc as $ancestor ) {
@@ -161,4 +161,10 @@ function is_tree( $pid ) {
     }
     return false;
 }
+function glm_has_shortcode($shortcode)
+{
+    global $post;
+    $page = get_post( $post->ID );
+    return has_shortcode( $page->post_content, $shortcode );
+}
 ?>
index 8699a02..83b399f 100644 (file)
--- a/index.php
+++ b/index.php
                 <?php
                 $isEmploymentAppPage = false;
                 if (shortcode_exists('glmjobs')) {
-                    $isEmploymentAppPage = true;
-                    $applyOnline = (isset($_REQUEST['applyOnline']))
-                        ? filter_var($_REQUEST['applyOnline'], FILTER_VALIDATE_INT)
-                        : false;
+                    $isEmploymentAppPage = glm_has_shortcode('glmjobs');
+                    if (defined('GLM_EMP_SETTING_NAME')) {
+                        $plugin_options = get_option(GLM_EMP_SETTING_NAME);
+                        $applyPageId = $plugin_options['employment_form_page'];
+                        if (is_page($applyPageId)) {
+                            $applyOnline = true;
+                        }
+                    }
+
+                    //$applyOnline = (isset($_REQUEST['applyOnline']))
+                        //? filter_var($_REQUEST['applyOnline'], FILTER_VALIDATE_INT)
+                        //: false;
                     $job = (isset($_REQUEST['job']))
                         ? filter_var($_REQUEST['job'], FILTER_VALIDATE_INT)
                         : false;
@@ -27,7 +35,7 @@
                         : false;
                 }
                 ?>
-                <?php if( !(is_page(2670)) && !$isEmploymentAppPage ) { ?>
+                <?php if( !(is_page(2670)) && !$isEmploymentAppPage  && !$applyOnline) { ?>
                 <div id="main-content" class="small-12 large-8 columns right">
                             <?php if(have_posts()) : while(have_posts()): the_post();?>
                             <?php the_content();?>
@@ -41,7 +49,7 @@
                 </div>
                 <?php } else { ?>
                 <div id="main-content" class="small-12 large-12 columns">
-                    <?php if (!$search && !$job && !$applyOnline):?>
+                    <?php if (!$search && !$job):?>
                         <?php if(have_posts()) : while(have_posts()): the_post();?>
                         <?php the_content();?>
                         <?php endwhile; else:?>