Skip to content

Instantly share code, notes, and snippets.

@woodwardtw
Created August 14, 2016 02:13
Show Gist options
  • Save woodwardtw/b468dd7a38474d18921b0fa3efd79d14 to your computer and use it in GitHub Desktop.
Save woodwardtw/b468dd7a38474d18921b0fa3efd79d14 to your computer and use it in GitHub Desktop.
gets SS ID from the URL
<?php
/**
* The template for displaying all single posts.
*
* @package pro
*/
get_header(); ?>
<?php if( get_option( 'page_for_posts' ) ) : $cover_page = get_page( get_option( 'page_for_posts' ) ); ?>
<?php if(get_post_meta($cover_page->ID, 'progression_page_title', true) == 'hide' ) : ?><?php else: ?>
<div id="soundbyte-page-title">
<div class="width-container-progression">
<?php if(function_exists('bcn_display')) { echo '<div id="bread-crumb-container"><div class="breadcrumbs-soundbyte"><ul id="breadcrumbs-pro"><li><a href="'; echo esc_url( home_url( '/' ) ); echo '">'; echo esc_html_e( 'Home', 'soundbyte-progression' ); echo '</a></li>'; bcn_display_list(); echo '</ul><div class="clearfix-progression"></div></div></div>'; }?>
<h1 id="page-title" class="entry-title-pro"><?php $page_for_posts = get_option('page_for_posts'); ?><?php echo get_the_title($page_for_posts); ?></h1>
<?php if(get_post_meta($cover_page->ID, 'progression_sub_title', true)) : ?><h2><?php echo esc_html( get_post_meta($cover_page->ID, 'progression_sub_title', true) );?></h2><?php endif; ?>
</div>
</div><!-- #page-title-pro -->
<?php endif; ?>
<?php else: ?>
<div id="soundbyte-page-title" style="background-image:url(<?php
the_post_thumbnail_url(); ?>) !important">
<div class="width-container-progression">
<h1 id="page-title" class="entry-title-pro"><?php the_title(); ?></h1>
</div>
</div><!-- #page-title-pro -->
<?php endif; ?>
<div id="content-pro" class="site-content">
<div class="width-container-progression<?php if( get_option( 'page_for_posts' ) ) : $cover_page = get_page( get_option( 'page_for_posts' ) ); ?><?php if(get_post_meta($cover_page->ID, 'progression_page_sidebar', true) == 'left-sidebar' ) : ?> left-sidebar-pro<?php endif; ?><?php endif; ?>">
<?php if( get_option( 'page_for_posts' ) ) : $cover_page = get_page( get_option( 'page_for_posts' ) ); ?>
<?php if(get_post_meta($cover_page->ID, 'progression_page_sidebar', true) == 'right-sidebar' ) : ?><div id="soundbyte-sidebar-container"><?php endif; ?>
<?php if(get_post_meta($cover_page->ID, 'progression_page_sidebar', true) == 'left-sidebar' ) : ?><div id="soundbyte-sidebar-container"><?php endif; ?>
<?php endif; ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'template-parts/content', 'single' ); ?>
<!-- ###################### stuff to show the student or course content ######################### -->
</div>
<?php
$gid = $_GET['id'];
$gslink = 'https://spreadsheets.google.com/feeds/list/' . $gid . '/1/public/basic?alt=json';
$json = file_get_contents($gslink);
$data = json_decode($json, TRUE);
$teamMembers = [];
//print_r($obj);
foreach ($data['feed']['entry'] as $item) {
array_push($teamMembers, $item['title']['$t']);
}
?>
<?php
$stu_id = get_post_meta( get_the_ID(), 'stu_id', true );
// Check if the custom field has a value.
$the_query = new WP_Query( array(
'meta_query' => array(
array(
'key' => 'stu_id',
'value' => $teamMembers,
'compare' => 'IN'
),
)
)
);
// The Loop
if ( $the_query->have_posts() ) :
echo '<div class="personal-full">';
while ( $the_query->have_posts() ) : $the_query->the_post();
$post_id = $post->ID;
//image previews across top
echo '<div class="personal-full-item"><a href="' . get_permalink() . '">';
echo get_the_post_thumbnail($post_id,'full', array( 'class' => 'aligncenter personal-big' ));
echo '</a><h3><a href="' . get_permalink() . '">';
echo get_the_title();
echo '</a></h3>';
echo '<div class="meta">' . get_the_date() . '</div>';
$content = apply_filters( 'the_content', get_the_content() );
echo $content . '</div>';
endwhile;
echo '</div>';
endif;
// Reset Post Data
wp_reset_postdata();
?>
<?php endwhile; // end of the loop. ?>
<?php if( get_option( 'page_for_posts' ) ) : $cover_page = get_page( get_option( 'page_for_posts' ) ); ?>
<?php if(get_post_meta($cover_page->ID, 'progression_page_sidebar', true) == 'right-sidebar' ) : ?></div><!-- close #main-container-pro --><?php get_sidebar(); ?><?php endif; ?>
<?php if(get_post_meta($cover_page->ID, 'progression_page_sidebar', true) == 'left-sidebar' ) : ?></div><!-- close #main-container-pro --><?php get_sidebar(); ?><?php endif; ?>
<?php endif; ?>
<div class="clearfix-progression"></div>
</div><!-- close .width-container-pro -->
</div><!-- #content-pro -->
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment