function custom_options_actions() { global $post; //global $detect;//Device Detection global $page_options; global $user_redirect_url; $page_options = custom_options(); //If there aren't any options set if (empty($page_options)) { return false; } //debug( clean_user_url( $page_options->redirect_ios ) ); $user_url = false; //Redirects //Android if (!empty($page_options->redirect_android) && $detect->isAndroidOS()) { $user_url = $page_options->redirect_android; } //iOS if (!empty($page_options->redirect_ios) && $detect->isiOS()) { $user_url = $page_options->redirect_ios; } //Windows Phone if (!empty($page_options->redirect_wf) && $detect->is('Windows Phone')) { $user_url = $page_options->redirect_wf; } //Default if (!empty($page_options->redirect)) { $user_url = $page_options->redirect; } if ($user_url) { //$redirect_url = clean_user_url( $user_url ); wp_redirect($user_url, '301'); debug($user_url); $user_redirect_url = $user_url; function custom_options_js_redirect() { global $user_redirect_url; echo '<script type="text/javascript">window.location.replace("' . $user_redirect_url . '");</script>//' . $user_url; } add_action('wp_head', 'custom_options_js_redirect'); } }
function social_media_profiles($strapped = 0, $profiles = 0) { //HTML Output $output = ''; //Current Pages Fields $options = custom_options(); //Option check if (empty($options)) { return false; } //Types of Profiles and Order $profiles_list = array('facebook', 'twitter', 'instagram', 'pinterest', 'vimeo', 'email'); //Filter Profiles for current page $profiles = array(); foreach ($profiles_list as $profile) { //if it isn't set skip if (empty($options->{$profile})) { continue; } array_push($profiles, $profile); } //Profiles check if (empty($profiles)) { return false; } $profiles_count = count($profiles); //Loop $p = 0; foreach ($profiles as $profile) { //12 if ($profiles_count & 1) { //if even $po = (12 - $profiles_count * 2) / 2; $pos = $po; $pw = 2; } else { //if odd $po = (12 - $profiles_count) / 2; $pos = (12 - $profiles_count * 2) / 2; $pw = 1; } $classes = 'social-bar-item'; if ($strapped) { $classes .= ' col-sm-' . $pw . ' col-xs-2'; } //Add offset to first if ($strapped && !$p) { $classes .= ' col-sm-offset-' . $po . ' col-xs-offset-' . $pos; } $output .= '<div class="' . $classes . '"><a href="' . $options->{$profile} . '"><i class="gc-' . $profile . '"></i></a></div>'; $p++; } //If $p is still 0 if (!$p) { return false; } return $output; }
static function handle_shortcode($atts) { self::$add_script = true; extract(shortcode_atts(array('class' => false, 'pages' => false, 'logos' => true), $atts, 'bars')); global $hero; //$hero->section_class = "row"; //$bars = if (empty($pages)) { $pages = array(91, 89, 95, 97, 101); //Youth Pages } else { $pages = explode(',', $pages); } // WP_Query arguments $args = array('post_type' => 'page', 'post__in' => $pages, 'orderby' => 'date'); // The Query $query = new WP_Query($args); //$query->post_count $last_post = $query->posts[$query->post_count - 1]; $hero_color = get_field('page_color', $last_post->ID); ob_start(); ?> <div class="container-fluid"> <div class="row youth-programs" style="<?php if ($hero_color) { echo "background:" . $hero_color . ";"; } ?> "> <?php $p = 0; if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); ?> <?php $count = $query->post_count; $options = custom_options(); $post_id = get_the_ID(); $featured = getImage($post_id, '720'); $logo = $featured; if (!empty($options->logo)) { $logo = $options->logo; } ?> <!-- Filler Bar --> <?php if ($p == 0) { ?> <div class="filler bar-bar col-md-1 hidden-sm hidden-xs ease" rel="" style="<?php //BG Color Overlay if (get_field('page_color')) { ?> background: <?php echo get_field('page_color'); ?> ; <?php //#000000 } ?> "></div> <?php } ?> <!-- bar-bar - <?php the_title(); ?> --> <div class="youth-program bar-bar col-md-2 ease bar-<?php echo $p; ?> " rel="" onclick="location.href='<?php the_permalink(); ?> ';" style="height: 400px; cursor: pointer; <?php //BG Color Overlay if (get_field('page_color')) { ?> background: <?php echo get_field('page_color'); ?> ; <?php //#000000 } ?> "> <?php /* if( !$logos ){ ?> <div class="bar-bg-image ease-opacity"> <img src="<?php echo $featured; ?>" alt="<?php the_title(); ?>"> </div> <?php } */ ?> <div class="bar-content"> <a href="<?php the_permalink(); ?> " title="<?php the_title(); ?> "> <div class="center"> <?php if ($logos) { ?> <span class="bar-logo"><img src="<?php echo $logo; ?> "></span> <?php } ?> <h2><?php the_title(); ?> </h2> <div class="hover-info"> <p></p> </div> <div class="social-icons ease-height"> <?php echo social_media_profiles(); ?> </div> </div> </a> </div> </div> <?php $p++; } } wp_reset_query(); //Clear query so nothing weird shows up after loop ?> <!-- end SECTION --> </div> </div> <?php $content = ob_get_clean(); return $content; }