<?php
-require_once 'lib/menu-walker.php';
-require_once 'lib/navigation.php';
-
-define( 'MEMBERS_ONLY_ID', get_option( GLM_MEMBERS_PLUGIN_OPTION_MEMBERS_ONLY_ID ) );
-
-$ancestorId = null;
-$includePages = array();
-$frontPageId = get_option('page_on_front');
-add_action('widgets_init', 'glm_quicksite_widget_init');
-
-if (!function_exists('glm_quicksite_widget_init')) {
-
- function glm_quicksite_widget_init()
- {
- register_sidebar(array(
- 'name' => __('Slideshow'),
- 'id' => 'slideshow',
- 'description' => __('Meta Slider/Slideshow Area')
- ));
- register_sidebar(array(
- 'name' => __('Right Sidebar'),
- 'id' => 'r-sidebar',
- 'description' => __('General Sidebar')
- ));
- register_sidebar(array(
- 'name' => __('Chamber Sidebar'),
- 'id' => 'chamber-side',
- 'description' => __('Sidebar for the Chamber Page')
- ));
- }
-
-}
-
-/**
- * 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;
- }
-}
-add_theme_support('custom-fieldss');
-add_theme_support('post-thumbnails');
-set_post_thumbnail_size(120, 100, true);
-add_post_type_support("page", 'excerpt');
-/**
- * glm_site_scripts
- *
- * Add the scripts that we'll need for any home page stuff
- */
-function glm_site_scripts()
-{
-// wp_enqueue_script(
-// 'modernizr',
-// get_template_directory_uri() . '/js/modernizr/modernizr.min.js'
-// );
- wp_enqueue_script('jquery');
- wp_enqueue_script(
- 'glm_foundation',
- get_template_directory_uri() . '/js/app.js',
- 'jquery',
- '1.0',
- true
- );
- if(is_front_page()) {
- }
-}
-
-
-/* Header for posts*/
-function glm_get_header() {
- echo '<div';
- if ( has_post_thumbnail() && is_page( array( 180,182,184,186,187,179 ) ) ) {
- $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(), "full");
- echo ' style="background-image: url('.$image_data[0].');height:0;padding:0;padding-bottom:20%;background-position:center center;background-size: 100%;background-repeat:no-repeat;max-height: 350px; "';
- } else {
- //echo ' style="background-image: url('.get_template_directory_uri().'/assets/default-header.gif);height:0;padding:0;padding-bottom:30%;background-position:center center;background-size: 100%;background-repeat:no-repeat;max-height: 300px;"';
- echo ' class="no-featured"';
- }
- echo '>';
- echo '</div>';
- echo '<div class="row">';
- echo '<div class="small-12 columns">';
- echo '</div>';
- echo '</div>';
-}
-
-// // The code below is useful when you want the image to resize to
-// if (has_post_thumbnail()) {
-// $image_data = wp_get_attachment_image_src(get_post_thumbnail_id(), "full");
-// echo '<img src="'.$image_data[0].'" style="no-repeat;max-height:400px;">';
-// } else {
-// echo '<img src="'.get_template_directory_uri().'/assets/default-header.gif" style="max-height:400px;">';
-// }
-// echo '<div class="row">';
-// echo '<div class="small-12 columns">';
-// echo '</div>';
-// echo '</div>';
-
-add_action('wp_enqueue_scripts', 'glm_site_scripts');
-
-
-// Start of the Contextual/Highlight Search functions
-function mytheme_init() {
- remove_action('thematic_searchloop', 'thematic_search_loop');
-}
-
-add_action('init', 'mytheme_init', 10);
-
-function wpse_setup_theme() {
- add_image_size('glm-block-image', 339, 507,true);
- add_image_size('dropdown-image', 270, 122, true);
- add_image_size('map-image', 200, 150, true);
-}
-
-add_action( 'after_setup_theme', 'wpse_setup_theme' );
-function mytheme_search_loop() {
- while ( have_posts() ) : the_post(); ?>
-
- <div id="post-<?php the_ID() ?>" class="<?php thematic_post_class() ?>">
- <?php thematic_postheader(); ?>
- <div class="entry-content">
- <?php thematic_content(); /* We will replace this next */ ?>
-
- </div>
- <?php thematic_postfooter(); ?>
- </div><!-- .post -->
-
- <?php endwhile;
-}
-
-function is_post_type($type){
- global $wp_query;
- if($type == get_post_type($wp_query->post->ID)) return true;
- return false;
-}
-
-add_action('thematic_searchloop', 'mytheme_search_loop');
-// End of the Contextual/Highlight Search functions
-
-// This series of functions is used for forcing a template if one or any is picked.
-// START FORCE TEMPLATE FUNCTIONS
-add_filter( 'template_include', 'glm_force_template', 99 );
-function glm_force_template( $template ) {
- if ($template != locate_template("woocommerce.php")) {
- $template = locate_template( "index.php" );
- }
- return $template;
-}
-function get_custom_page_templates() {
- $templates = array();
- // maybe by options? --> $templates = get_option( 'custom_page_templates' );
- // maybe by conf file? --> $templates = include 'custom_page_templates.php';
- return apply_filters( 'custom_page_templates', $templates );
-}
-add_action( 'edit_form_after_editor', 'custom_page_templates_init' );
-add_action( 'load-post.php', 'custom_page_templates_init_post' );
-add_action( 'load-post-new.php', 'custom_page_templates_init_post' );
-
-function custom_page_templates_init() {
- remove_action( current_filter(), __FUNCTION__ );
- if ( is_admin() && get_current_screen()->post_type === 'page' ) {
- $templates = get_custom_page_templates(); // the function above
- if ( ! empty( $templates ) ) {
- set_custom_page_templates( $templates );
- }
- }
-}
-function custom_page_templates_init_post() {
- remove_action( current_filter(), __FUNCTION__ );
- $method = filter_input( INPUT_SERVER, 'REQUEST_METHOD', FILTER_SANITIZE_STRING );
- if ( empty( $method ) || strtoupper( $method ) !== 'POST' ) return;
- if ( get_current_screen()->post_type === 'page' ) {
- custom_page_templates_init();
- }
-}
-function set_custom_page_templates( $templates = array() ) {
- if ( ! is_array( $templates ) || empty( $templates ) ) return;
- $core = array_flip( (array) get_page_templates() ); // templates defined by file
- $data = array_filter( array_merge( $core, $templates ) );
- ksort( $data );
- $stylesheet = get_stylesheet();
- $hash = md5( get_theme_root( $stylesheet ) . '/' . $stylesheet );
- $persistently = apply_filters( 'wp_cache_themes_persistently', false, 'WP_Theme' );
- $exp = is_int( $persistently ) ? $persistently : 1800;
- wp_cache_set( 'page_templates-' . $hash, $data, 'themes', $exp );
-}
-add_filter( 'custom_page_templates', function( $now_templates ) {
- // Any slug->name pairs down here will be selectable in the admin side of
- // a page. You do not need to create a new template file. You can refer to
- // this template by its slug in our index.php using get_page_template_slug
- // Below are some commented examples of custom quasi-templates.
- $templates = array(
- 'page-chamber' => 'Chamber Page',
- 'no-sidebar' => 'No Sidebar'
- // 'any-template-slug' => 'Sample Template' ,
- );
-
- return array_merge( $now_templates, $templates );
-} );
-// END FORCE TEMPLATE FUNCTIONS
-
-
-// THIS IS HOW IT CAN BE USED IN INDEX.PHP
-// if (get_page_template_slug( $post->ID ) == "some-custom-page-template") {
-// echo "<div id='block'>[I am totally not a block ._.]</div>";
-// } else {
-// echo "<p>The current template used is:".get_page_template_slug( $post->ID )."</p>";
-// }
-
-/*
- * 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;
- }
-}
-
-if ( ! function_exists( 'glm_members_only_menu')) {
- function glm_members_only_menu() {
- wp_nav_menu(array(
- 'container' => false, // remove nav container
- 'container_class' => 'members-only-menu', // class of container
- 'menu' => '', // menu name
- 'menu_class' => 'members-only-menu', // adding custom nav class
- 'theme_location' => 'members-only-menu', // where it's located in the theme
- 'before' => '', // before each link <a>
- 'after' => '', // after each link </a>
- 'link_before' => '', // before each link text
- 'link_after' => '', // after each link text
- 'depth' => 2, // limit the depth of the nav
- 'fallback_cb' => false, // fallback function (see below)
- 'items_wrap' => '%3$s',
- 'walker' => new GLM_Members_Only_Walker()
- ));
- }
-}
-
-if ( ! class_exists( 'GLM_Members_Only_Walker' ) ) :
-class GLM_Members_Only_Walker extends Walker_Nav_Menu {
-
- function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
- $element->has_children = ! empty( $children_elements[ $element->ID ] );
- $element->classes[] = ( $element->current || $element->current_item_ancestor ) ? 'active' : '';
- $element->classes[] = ( $element->has_children && 1 !== $max_depth ) ? 'page_item_has_children' : '';
- $element->classes[] = 'page_item';
-
- parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
- }
-
- function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
- $item_html = '';
- parent::start_el( $item_html, $object, $depth, $args );
-
- $classes = empty( $object->classes ) ? array() : (array) $object->classes;
-
- if ( in_array( 'label', $classes ) ) {
- $item_html = preg_replace( '/<a[^>]*>(.*)<\/a>/iU', '<label>$1</label>', $item_html );
- }
-
- $output .= $item_html;
- }
-
- function start_lvl( &$output, $depth = 0, $args = array() ) {
- $output .= "\n<ul class=\"children\">\n";
- }
-
- function end_lvl(&$output, $depth = 0, $args = array()){
- $output .= '</ul>';
- }
-
-}
-endif;
-
-function remove_billing_fields( $fields ) {
- global $woocommerce;
- // if the total is more than 0 then we still need the fields
- if ( 0 != $woocommerce->cart->total ) {
- return $fields;
- }
- // return the regular billing fields if we need shipping fields
- if ( $woocommerce->cart->needs_shipping() ) {
- return $fields;
- }
- // we don't need the billing fields so empty all of them except the email
- unset( $fields['billing_country'] );
- unset( $fields['billing_first_name'] );
- unset( $fields['billing_last_name'] );
- unset( $fields['billing_company'] );
- unset( $fields['billing_address_1'] );
- unset( $fields['billing_address_2'] );
- unset( $fields['billing_city'] );
- unset( $fields['billing_state'] );
- unset( $fields['billing_postcode'] );
- unset( $fields['billing_phone'] );
- unset( $fields['billing_email'] );
- return $fields;
-}
-
+ require_once 'lib/defines.php';
+ require_once 'lib/menu-walker.php';
+ require_once 'lib/navigation.php';
+ include_once 'lib/images.php';
+ include_once 'lib/header.php';
+ include_once 'lib/misc.php';
+ include_once 'lib/widgets.php';
+ include_once 'lib/enqueueing.php';
+ include_once 'lib/images.php';
+ include_once 'lib/plugins.php';
?>
\ No newline at end of file
--- /dev/null
+<?php
+// This series of functions is used for forcing a template if one or any is picked.
+// THIS IS HOW IT CAN BE USED IN INDEX.PHP
+// if (get_page_template_slug( $post->ID ) == "some-custom-page-template") {
+// echo "<div id='block'>[I am totally not a block ._.]</div>";
+// } else {
+// echo "<p>The current template used is:".get_page_template_slug( $post->ID )."</p>";
+// }
+
+add_filter( 'template_include', 'glm_force_template', 99 );
+function glm_force_template( $template ) {
+ if ($template != locate_template("woocommerce.php")) {
+ $template = locate_template( "index.php" );
+ }
+ return $template;
+}
+function get_custom_page_templates() {
+ $templates = array();
+ // maybe by options? --> $templates = get_option( 'custom_page_templates' );
+ // maybe by conf file? --> $templates = include 'custom_page_templates.php';
+ return apply_filters( 'custom_page_templates', $templates );
+}
+add_action( 'edit_form_after_editor', 'custom_page_templates_init' );
+add_action( 'load-post.php', 'custom_page_templates_init_post' );
+add_action( 'load-post-new.php', 'custom_page_templates_init_post' );
+
+function custom_page_templates_init() {
+ remove_action( current_filter(), __FUNCTION__ );
+ if ( is_admin() && get_current_screen()->post_type === 'page' ) {
+ $templates = get_custom_page_templates(); // the function above
+ if ( ! empty( $templates ) ) {
+ set_custom_page_templates( $templates );
+ }
+ }
+}
+function custom_page_templates_init_post() {
+ remove_action( current_filter(), __FUNCTION__ );
+ $method = filter_input( INPUT_SERVER, 'REQUEST_METHOD', FILTER_SANITIZE_STRING );
+ if ( empty( $method ) || strtoupper( $method ) !== 'POST' ) return;
+ if ( get_current_screen()->post_type === 'page' ) {
+ custom_page_templates_init();
+ }
+}
+function set_custom_page_templates( $templates = array() ) {
+ if ( ! is_array( $templates ) || empty( $templates ) ) return;
+ $core = array_flip( (array) get_page_templates() ); // templates defined by file
+ $data = array_filter( array_merge( $core, $templates ) );
+ ksort( $data );
+ $stylesheet = get_stylesheet();
+ $hash = md5( get_theme_root( $stylesheet ) . '/' . $stylesheet );
+ $persistently = apply_filters( 'wp_cache_themes_persistently', false, 'WP_Theme' );
+ $exp = is_int( $persistently ) ? $persistently : 1800;
+ wp_cache_set( 'page_templates-' . $hash, $data, 'themes', $exp );
+}
+add_filter( 'custom_page_templates', function( $now_templates ) {
+ // Any slug->name pairs down here will be selectable in the admin side of
+ // a page. You do not need to create a new template file. You can refer to
+ // this template by its slug in our index.php using get_page_template_slug
+ // Below are some commented examples of custom quasi-templates.
+ $templates = array(
+ 'page-chamber' => 'Chamber Page',
+ 'no-sidebar' => 'No Sidebar'
+ // 'any-template-slug' => 'Sample Template' ,
+ );
+
+ return array_merge( $now_templates, $templates );
+} );
\ No newline at end of file
--- /dev/null
+<?php
+
+if ( ! class_exists( 'GLM_Members_Only_Walker' ) ) :
+class GLM_Members_Only_Walker extends Walker_Nav_Menu {
+
+ function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
+ $element->has_children = ! empty( $children_elements[ $element->ID ] );
+ $element->classes[] = ( $element->current || $element->current_item_ancestor ) ? 'active' : '';
+ $element->classes[] = ( $element->has_children && 1 !== $max_depth ) ? 'page_item_has_children' : '';
+ $element->classes[] = 'page_item';
+
+ parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
+ }
+
+ function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
+ $item_html = '';
+ parent::start_el( $item_html, $object, $depth, $args );
+
+ $classes = empty( $object->classes ) ? array() : (array) $object->classes;
+
+ if ( in_array( 'label', $classes ) ) {
+ $item_html = preg_replace( '/<a[^>]*>(.*)<\/a>/iU', '<label>$1</label>', $item_html );
+ }
+
+ $output .= $item_html;
+ }
+
+ function start_lvl( &$output, $depth = 0, $args = array() ) {
+ $output .= "\n<ul class=\"children\">\n";
+ }
+
+ function end_lvl(&$output, $depth = 0, $args = array()){
+ $output .= '</ul>';
+ }
+
+}
+endif;
+
+
+if ( ! function_exists( 'glm_members_only_menu')) {
+ function glm_members_only_menu() {
+ wp_nav_menu(array(
+ 'container' => false, // remove nav container
+ 'container_class' => 'members-only-menu', // class of container
+ 'menu' => '', // menu name
+ 'menu_class' => 'members-only-menu', // adding custom nav class
+ 'theme_location' => 'members-only-menu', // where it's located in the theme
+ 'before' => '', // before each link <a>
+ 'after' => '', // after each link </a>
+ 'link_before' => '', // before each link text
+ 'link_after' => '', // after each link text
+ 'depth' => 2, // limit the depth of the nav
+ 'fallback_cb' => false, // fallback function (see below)
+ 'items_wrap' => '%3$s',
+ 'walker' => new GLM_Members_Only_Walker()
+ ));
+ }
+}
\ No newline at end of file