Last active
January 22, 2018 17:33
-
-
Save mrpatg/8d3adbdc1d2be459175769f9c34e463f to your computer and use it in GitHub Desktop.
wp show post content
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * The Header for our theme | |
| * | |
| * Displays all of the <head> section and everything up till <div id="main"> | |
| * | |
| * @package WordPress | |
| * @subpackage Twenty_Fourteen | |
| * @since Twenty Fourteen 1.0 | |
| */ | |
| ?><!DOCTYPE html> | |
| <!--[if IE 7]> | |
| <html class="ie ie7" <?php language_attributes(); ?>> | |
| <![endif]--> | |
| <!--[if IE 8]> | |
| <html class="ie ie8" <?php language_attributes(); ?>> | |
| <![endif]--> | |
| <!--[if !(IE 7) & !(IE 8)]><!--> | |
| <html <?php language_attributes(); ?>> | |
| <!--<![endif]--> | |
| <head> | |
| <meta charset="<?php bloginfo( 'charset' ); ?>"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title><?php wp_title( '|', true, 'right' ); ?></title> | |
| <link rel="profile" href="http://gmpg.org/xfn/11"> | |
| <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> | |
| <!--[if lt IE 9]> | |
| <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script> | |
| <![endif]--> | |
| <?php wp_head(); ?> | |
| <script> | |
| jQuery(document).ready(function($){ | |
| $.ajaxSetup({cache:false}); | |
| //$("a").click(function(e){ | |
| $(".main-menu-item a").click(function(){ | |
| //e.preventDefault(); | |
| pageurl = $(this).attr('href'); | |
| if(pageurl!=window.location) { | |
| window.history.pushState({path: pageurl}, '', pageurl); | |
| } | |
| var post_id = $(this).attr("rel") | |
| if(post_id == null){ | |
| window.location.href = pageurl; | |
| return false; | |
| } | |
| $('.current-menu-item').removeClass('current-menu-item'); | |
| $('.current_page_item').removeClass('current_page_item'); | |
| $(this).parent().toggleClass("current_page_item"); | |
| $(this).parent().toggleClass("current-menu-item"); | |
| //var post_content = $("#main-content").load("http://<?php echo $_SERVER[HTTP_HOST]; ?>/ajax/",{id:post_id}); // line 12 | |
| if(post_id == 445){ | |
| //$("#main-content").css("display", "none"); | |
| //$("#shopping-cart").css("display", "block"); | |
| }else{ | |
| //$("#shopping-cart").css("display", "none"); | |
| //$("#main-content").css("display", "block"); | |
| $("#main-content").load("http://<?php echo $_SERVER[HTTP_HOST]; ?>/ajax/",{id:post_id}); // line 12 | |
| } | |
| return false; | |
| }); | |
| // opening time - 24 hours so 9:30am is 9, 30 | |
| //var Open = (Now.getTime() > OpeningTime.getTime() && Now.getTime() < ClosingTime.getTime()) | |
| // days 0.sun 1.mon 2.tues 3.wed 4.thur 5.fri 6.sat | |
| // CurrentDay !== 0 && the # is the day to eclude, so if I want to be closed on Sat6, Sun0, Wed3 | |
| // CurrentDay !== 6 && CurrentDay !== 0 && CurrentDay !== 3 && Open | |
| <?php | |
| $query = new WP_Query(array( | |
| 'post_type' => 'showbanners', | |
| 'post_status' => 'publish' | |
| )); | |
| echo "var shows = [];"; | |
| while ($query->have_posts()) { | |
| $query->the_post(); | |
| $post_id = get_the_ID(); | |
| //echo "console.log(".$post_id.");"; | |
| echo "shows['".$post_id."'] = {day: '".get_field('show_day', $post_id)."',name: '".get_field('show_name', $post_id)."',start: '".get_field('show_start', $post_id)."', end: '".get_field('show_stop', $post_id)."', banner: '".get_field('show_banner', $post_id)."', link: '".get_field('show_link', $post_id)."'};\n\r"; | |
| } | |
| wp_reset_query(); | |
| ?> | |
| //console.log(shows); | |
| function liveShow(){ | |
| var Now = new Date(); | |
| var CurrentDay = Now.getDay(); | |
| var CurrentHour = Now.getHours(); | |
| var CurrentMinute = Now.getMinutes(); | |
| var CurrentTime = new Date(Now.getFullYear(), Now.getMonth(), Now.getDay(), Now.getHours(), Now.getMinutes()); | |
| var onAir = 0; | |
| console.log("liveShow Running"); | |
| for(key in shows) { | |
| //console.log( shows[key] ); | |
| var startSplit = shows[key]["start"].split(":"); | |
| var startHours = startSplit[0]; | |
| var startMinutes = startSplit[1]; | |
| var startDay = shows[key]["day"]; | |
| var StartTime = new Date(Now.getFullYear(), Now.getMonth(), startDay, startHours, startMinutes); | |
| //console.log(StartTime); | |
| var stopSplit = shows[key]["end"].split(":"); | |
| var stopHours = stopSplit[0]; | |
| var stopMinutes = stopSplit[1]; | |
| var stopDay = shows[key]["day"]; | |
| var StopTime = new Date(Now.getFullYear(), Now.getMonth(), stopDay, stopHours, stopMinutes); | |
| //console.log(StopTime); | |
| if((CurrentTime >= StartTime && CurrentTime <= StopTime)){ | |
| //$("#liveShow").attr("src", ); | |
| $("#liveShow").attr("src", shows[key]['banner']); | |
| var onAir = 1; | |
| console.log("we got a live one"); | |
| } | |
| } | |
| if(onAir == 0){ | |
| $("#liveShow").attr("src", ""); | |
| console.log("nothing live"); | |
| } | |
| $(".the_wrapper").css({ 'margin' : '0px 0px'}); | |
| } | |
| liveShow(); | |
| setInterval(liveShow,1000); | |
| //console.log(CurrentTime); | |
| }); | |
| </script> | |
| </head> | |
| <body <?php body_class(); ?>> | |
| <div id="page" class="hfeed site"> | |
| <?php if ( get_header_image() ) : ?> | |
| <div id="site-header"> | |
| <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"> | |
| <img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"> | |
| </a> | |
| </div> | |
| <?php endif; ?> | |
| <div class="audio-player"> | |
| <?php echo do_shortcode('[lbg_audio6_html5_shoutcast settings_id="1"]'); ?> | |
| <?php | |
| // Content area beneath audio player. Edit page "Beneath Audio Player" or change post id | |
| echo the_content("780"); | |
| ?> | |
| </div> | |
| <header id="masthead" class="site-header" role="banner"> | |
| <div class="header-main"> | |
| <h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> | |
| <div class="search-toggle"> | |
| <a href="#search-container" class="screen-reader-text" aria-expanded="false" aria-controls="search-container"><?php _e( 'Search', 'twentyfourteen' ); ?></a> | |
| </div> | |
| <nav id="primary-navigation" class="site-navigation primary-navigation" role="navigation"> | |
| <button class="menu-toggle"><?php _e( 'Primary Menu', 'twentyfourteen' ); ?></button> | |
| <a class="screen-reader-text skip-link" href="#content"><?php _e( 'Skip to content', 'twentyfourteen' ); ?></a> | |
| <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu', 'menu_id' => 'primary-menu', 'walker' => new Ajax_Walker ) ); ?> | |
| </nav> | |
| </div> | |
| <div id="search-container" class="search-box-wrapper hide"> | |
| <div class="search-box"> | |
| <?php get_search_form(); ?> | |
| </div> | |
| </div> | |
| </header><!-- #masthead --> | |
| <div id="main" class="site-main"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment