Members Only-friendly theme updates
authorLaury GvR <laury@gaslightmedia.com>
Thu, 28 Apr 2016 19:08:18 +0000 (15:08 -0400)
committerLaury GvR <laury@gaslightmedia.com>
Thu, 28 Apr 2016 19:08:18 +0000 (15:08 -0400)
css/app.css
functions.php
glm-members-only-template.php [new file with mode: 0644]
lib/navigation.php
sample-template.php [deleted file]
scss/_sidebar.scss

index 686ff93..677d63f 100644 (file)
@@ -7465,6 +7465,9 @@ article {
     border-radius: 2px;
     padding: 0 10px; }
 
+.members-only-template #side-links #menu-side h2 {
+  font-size: 26px; }
+
 #side-links #menu-side {
   background: #2c296d;
   padding-top: 20px;
index 291f455..52156df 100644 (file)
@@ -146,20 +146,7 @@ function mytheme_search_loop() {
 
   <?php endwhile;
 }
-function is_tree( $pid ) {
-    global $post;
 
-    if ( is_page($pid) )
-        return true;
-
-    $anc = get_post_ancestors( $post->ID );
-    foreach ( $anc as $ancestor ) {
-        if( is_page() && $ancestor == $pid ) {
-            return true;
-        }
-    }
-    return false;
-}
 add_action('thematic_searchloop', 'mytheme_search_loop');
 // End of the Contextual/Highlight Search functions
 
@@ -200,16 +187,25 @@ function remove_admin_bar() {
       show_admin_bar(false);
     }
 }
-add_filter( 'template_include', 'portfolio_page_template', 99 );
 
-function portfolio_page_template( $template ) {
-    if ( is_tree(27)  ) { // the members page for this site
-        $new_template = locate_template( array( 'sample-template.php' ) );
-        if ( '' != $new_template ) {
-                return $new_template ;
+/*
+ * This function returns true when the current page is the page given by ID
+ *  or a descendent thereof.
+ */
+if (!function_exists('is_in_tree')) {
+    function is_in_tree( $pid ) {
+        global $post;
+
+        if ( is_page($pid) )
+            return true;
+
+        $anc = get_post_ancestors( $post->ID );
+        foreach ( $anc as $ancestor ) {
+            if( is_page() && $ancestor == $pid ) {
+                return true;
+            }
         }
+        return false;
     }
-
-    return $template;
 }
 ?>
diff --git a/glm-members-only-template.php b/glm-members-only-template.php
new file mode 100644 (file)
index 0000000..20c907c
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+/*
+Template Name: GLM Members Only Template
+*/
+?>
+<?php get_header(); ?>
+<main class="page-inside members-only-template">
+    <div class="feature-img">
+        <?php echo glm_get_header(); ?>
+    </div>
+    <div id="content-wrapper">
+        <div class="row">
+        <?php if(is_page(3714)){ ?>
+            <div class="small-12 large-12 columns right">
+        <?php } else { ?>
+            <div class="small-12 large-8 columns right">
+        <?php } ?>
+                <div class="row">
+                    <div id="main-content" class="small-12 columns">
+                    <?php if (current_user_can("glm_members_login")) { ?>
+                            <div id="glm-member-front-header" class="small-12 columns">
+                                <div class='glm-member-greeting'>Hello,     <?php $current_user = wp_get_current_user();echo $current_user->user_login ?>.</div>
+                                <a class='button glm-button' href="<?php echo wp_logout_url( home_url() ); ?>">Logout</a>
+                                <?php if (current_user_can("glm_members_member")) { ?>
+                                    <a class='button glm-button' href='<?php echo get_admin_url() ?>admin.php?page=glm-members-admin-menu-members'>Enter Member Admin Area</a>                        
+                                <?php } ?>
+                            </div>
+                        <?php get_template_part('parts/bread-crumbs'); ?>
+                        
+                            <?php if(have_posts()) : while(have_posts()): the_post();?>
+                            <?php the_content();?>
+                            <?php endwhile; else:?>
+                            <p><?php _e('Sorry, no results found.');?></p>
+                            <?php endif;?>
+                        
+                    <?php } else { ?>
+                            <p id="glm-member-login-notification">Please log in to gain access to this page</p>
+                            <div id='glm-member-login-form'>
+                            <?php wp_login_form(1, get_permalink()); ?>
+                        </div>
+                    <?php } ?>
+                    </div>
+                </div>
+            </div>
+            <?php if(! (is_page(3714))){ ?>
+                <?php get_sidebar(); ?>
+            <?php } ?>
+            <div class="small-12 columns small-center text-center">
+                <a id="big-lens"><h1>#DiscoverKZoo</h1></a>
+            </div>
+        </div>
+        <?php if ((get_post_type( $post ) != "ai1ec_event") && ($post != get_post(3198))  && ($post != get_post(1140))) { ?>
+        <div id="bottom-lens">
+            <script id="cr__init-b054762a" src="https://embed.crowdriff.com/js/init?hash=b054762a"></script>
+        </div>
+        <?php } ?>
+    </div>
+
+<?php get_footer(); ?>
index 076a0ef..69e299f 100644 (file)
@@ -188,10 +188,15 @@ function glm_side_menu($mobile = false) {
     global $post;
     $sideMenu = $allMenu = $pageMenuId = array();
 //     do not use appearance menu for the following page ID's or their ancestors
-    if( !is_page(array(3200, 3201,3202,3203)) && !is_tree(3200) && !is_tree(3201) && !is_tree(3202) && !is_tree(3203)) {
+    //if( !is_page(array(3200, 3201,3202,3203)) && !is_in_tree(3200) && !is_in_tree(3201) && !is_in_tree(3202) && !is_in_tree(3203)) {
+    if (is_in_tree(get_option('glm_members_database_members_only_id'))) { 
+        if (($locations = get_nav_menu_locations()) && isset($locations['members-only'])) {
+            $menu       = wp_get_nav_menu_object($locations['members-only']);
+        }
+    } else if( !is_in_tree(3200) && !is_in_tree(3201) && !is_in_tree(3202) && !is_in_tree(3203)) {
         if (($locations = get_nav_menu_locations()) && isset($locations['top-bar'])) {
-                $menu       = wp_get_nav_menu_object($locations['top-bar']);
-            }
+            $menu       = wp_get_nav_menu_object($locations['top-bar']);
+        }
     } else {
         if (($locations = get_nav_menu_locations()) && isset($locations['top-links'])) {
             $menu       = wp_get_nav_menu_object($locations['top-links']);
diff --git a/sample-template.php b/sample-template.php
deleted file mode 100644 (file)
index a9fd506..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/*
-Template Name: Sample Template
-*/
-?>
-<?php get_header(); ?>
-<main class="page-inside sample-template">
-    <div class="feature-img">
-        <?php echo glm_get_header(); ?>
-    </div>
-    <div id="content-wrapper">
-        <div class="row">
-        <?php if(is_page(3714)){ ?>
-            <div class="small-12 large-12 columns right">
-        <?php } else { ?>
-            <div class="small-12 large-8 columns right">
-        <?php } ?>
-                <div class="row">
-                    <div id="main-content" class="small-12 columns">
-                    <?php if (current_user_can("glm_members_login")) { ?>
-                            <div id="glm-member-front-header" class="small-12 columns">
-                                <div class='glm-member-greeting'>Hello,     <?php $current_user = wp_get_current_user();echo $current_user->user_login ?>.</div>
-                                <a class='button glm-button' href="<?php echo wp_logout_url( get_permalink() ); ?>">Logout</a>
-                                <?php if (current_user_can("glm_members_member")) { ?>
-                                    <a class='button glm-button' href='<?php echo get_admin_url() ?>admin.php?page=glm-members-admin-menu-members'>Enter Member Admin Area</a>                        
-                                <?php } ?>
-                            </div>
-                        <?php get_template_part('parts/bread-crumbs'); ?>
-                        
-                            <?php if(have_posts()) : while(have_posts()): the_post();?>
-                            <?php the_content();?>
-                            <?php endwhile; else:?>
-                            <p><?php _e('Sorry, no results found.');?></p>
-                            <?php endif;?>
-                        
-                    <?php } else { ?>
-                            <p id="glm-member-login-notification">Please log in to gain access to this page</p>
-                            <div id='glm-member-login-form'>
-                            <?php wp_login_form(1, get_permalink()); ?>
-                        </div>
-                    <?php } ?>
-                    </div>
-                </div>
-            </div>
-            <?php if(! (is_page(3714))){ ?>
-                <?php get_sidebar(); ?>
-            <?php } ?>
-            <div class="small-12 columns small-center text-center">
-                <a id="big-lens"><h1>#DiscoverKZoo</h1></a>
-            </div>
-        </div>
-        <?php if ((get_post_type( $post ) != "ai1ec_event") && ($post != get_post(3198))  && ($post != get_post(1140))) { ?>
-        <div id="bottom-lens">
-            <script id="cr__init-b054762a" src="https://embed.crowdriff.com/js/init?hash=b054762a"></script>
-        </div>
-        <?php } ?>
-    </div>
-
-<?php get_footer(); ?>
index 20c9c5a..5e212e3 100644 (file)
         padding: 0 10px;
     }
 }
+.members-only-template #side-links #menu-side {
+    h2 {
+        font-size: 26px;
+    }
+}
 #side-links {
     #menu-side {
         background: $purple;