From: Laury GvR Date: Thu, 28 Apr 2016 19:08:18 +0000 (-0400) Subject: Members Only-friendly theme updates X-Git-Tag: v1.0.0^2~67 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=714848440408f5282371bf313077f30c0d314b99;p=WP-Themes%2FDiscoverKZOO.git Members Only-friendly theme updates --- diff --git a/css/app.css b/css/app.css index 686ff93..677d63f 100644 --- a/css/app.css +++ b/css/app.css @@ -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; diff --git a/functions.php b/functions.php index 291f455..52156df 100644 --- a/functions.php +++ b/functions.php @@ -146,20 +146,7 @@ function mytheme_search_loop() { 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 index 0000000..20c907c --- /dev/null +++ b/glm-members-only-template.php @@ -0,0 +1,59 @@ + + +
+
+ +
+
+
+ +
+ +
+ +
+
+ +
+
Hello, user_login ?>.
+ Logout + + Enter Member Admin Area + +
+ + + + + +

+ + + +

Please log in to gain access to this page

+
+ +
+ +
+
+
+ + + + +
+ +
+ +
+ +
+ + diff --git a/lib/navigation.php b/lib/navigation.php index 076a0ef..69e299f 100644 --- a/lib/navigation.php +++ b/lib/navigation.php @@ -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 index a9fd506..0000000 --- a/sample-template.php +++ /dev/null @@ -1,59 +0,0 @@ - - -
-
- -
-
-
- -
- -
- -
-
- -
-
Hello, user_login ?>.
- Logout - - Enter Member Admin Area - -
- - - - - -

- - - -

Please log in to gain access to this page

-
- -
- -
-
-
- - - - -
- -
- -
- -
- - diff --git a/scss/_sidebar.scss b/scss/_sidebar.scss index 20c9c5a..5e212e3 100644 --- a/scss/_sidebar.scss +++ b/scss/_sidebar.scss @@ -44,6 +44,11 @@ padding: 0 10px; } } +.members-only-template #side-links #menu-side { + h2 { + font-size: 26px; + } +} #side-links { #menu-side { background: $purple;