Skip to content

Instantly share code, notes, and snippets.

@whyisjake
Created November 14, 2011 01:48
Show Gist options
  • Save whyisjake/1363050 to your computer and use it in GitHub Desktop.
Save whyisjake/1363050 to your computer and use it in GitHub Desktop.
For Each
<?php get_header(); ?>
<div class="row">
<?php
global $wp_query;
$postid = $wp_query->post->ID;
$big_video = get_post_custom_values('Big_Video');
if (isset($big_video[0])) {
?>
<div class="big_video span16">
<?php make_youtube_embed('940', '528'); ?>
</div>
<?php }
$big_gallery = get_post_custom_values('Big_Gallery');
if($big_gallery[0] == 1) {
echo do_shortcode('[gallery size="big-thumb"]');
}
?>
<div class="span10">
<?php if (!is_home()) { ?>
<ul class="breadcrumb">
<?php if(class_exists('bcn_breadcrumb_trail'))
{
$breadcrumb_trail = new bcn_breadcrumb_trail;
$breadcrumb_trail->opt['home_title'] = "Home";
$breadcrumb_trail->opt['current_item_prefix'] = '<li class="project">Make: Projects</li><span class="divider">&nbsp;/&nbsp;</span><li class="current">';
$breadcrumb_trail->opt['current_item_suffix'] = '</li>';
$breadcrumb_trail->opt['separator'] = '<span class="divider">&nbsp;/&nbsp;</span>';
$breadcrumb_trail->opt['home_prefix'] = '<li>';
$breadcrumb_trail->opt['home_suffix'] = '</li>';
$breadcrumb_trail->opt['max_title_length'] = 70;
$breadcrumb_trail->fill();
$breadcrumb_trail->display();
} ?>
</ul>
<?php } ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<article <?php post_class(); ?>>
<style type="text/css">
.project { width:580px; }
.big_images { width:300px; float:left; }
.right_column {padding-left:20px; width:260px; float:left; }
.clear { clear:both;}
.thumbnail {margin:0px; margin-right:10px; padding:3px; border:1px; solid #999; background-color:#eee;}
h3, h4, h5, h6 { line-height: 24px; margin-bottom: 18px; }
.parts, .tools { width: 280px; display: inline; float: left;}
.parts { margin-right:20px; }
</style>
<?php
$json = file_get_contents('http://makeprojects.com/api/0.1/guide/1019');
$json_output = json_decode($json);
//print_r($json_output);
echo '<h1>'.$json_output->guide->title.'</h1>';
echo '<p class="summary">'.$json_output->guide->summary.'</p>';
echo '<p><strong>Author</strong>: '.$json_output->guide->author->text;
echo ' <strong>Time Required</strong>: '.$json_output->guide->time_required;
echo ' <strong>Difficulty</strong>: '.$json_output->guide->difficulty.'</p>'; ?>
<div class="entry-content">
<img src="<?php echo $json_output->guide->image->text; ?>.standard" class="thumbnail" alt="<?php echo $json_output->guide->title; ?>" align="right" />
<?php echo '<div class="summary">'.$json_output->guide->introduction_rendered.'</div>' ?>
<div class="clear"></div>
</div>
<div class="row">
<div class="span5">
<strong>Sections</strong>
<ol>
<?php
$steps = $json_output->guide->steps;
foreach ($steps as $step) {
echo '<li>';
echo '<a href="#'.$step->number.'">';
echo $step->title;
echo '</a></li>';
}
?>
</ol>
</div>
<div class="span5">
<strong>Files</strong>
<ul>
<?php
$documents = $json_output->guide->documents;
foreach ($documents as $document) {
echo '<li>';
echo '<a href="'.$document->url.'">';
echo $document->text;
echo '</a></li>';
}
?>
</ul>
</div>
</div>
<div class="clear"></div>
<?php
$i = 0;
foreach ($steps as $step) {
//var_dump($step);
echo '<div class="project" id="'.$step->number.'">';
echo '<div class="big_images">';
$images = $step->images;
foreach ($images as $image) {
//var_dump($image);
echo '<img src="';
echo $image->text;
echo '.standard" class="'.$image->imageid.' '.$image->orderby.'" />';
}
echo '</div><!--.big_images-->';
echo '<div class="right_column">';
$images = $step->images;
foreach ($images as $image) {
//var_dump($image);
echo '<img src="';
echo $image->text;
echo '.thumbnail" class="thumbnail span1 '.$image->imageid.' '.$image->orderby.'" />';
}
$lines = $step->lines;
echo '<h3 class="clear">Step #'.$step->number.' '.$step->title.'</h3>';
echo '<ul>';
foreach ($lines as $line) {
//var_dump($line);
echo '<li>';
echo $line->text;
echo '</li>';
}
echo '</div><!--.right_column-->';
echo '<div class="clear"></div><!--.clear-->';
echo '</div><!--.project-->';
echo '<div class="conclusion">';
if (++$i == 2) break;
}
echo $json_output->guide->conclusion;
?>
</div>
<?php the_content(); ?>
<?php if (function_exists('vip_display_related_posts')) { vip_display_related_posts(); } ?>
</article>
<div class="postmeta row clear">
<div class="span1">
<?php echo get_avatar( get_the_author_meta('user_email'), 40); ?>
</div>
<div class="span8">
<p>Posted by <?php the_author_posts_link(); ?> | <a href="<?php the_permalink(); ?>"><?php the_time('l F jS, Y g:i A'); ?></a></p>
<p>Categories: <?php the_category(', '); ?> | <?php comments_popup_link(); ?> <?php edit_post_link('Fix me...', ' | '); ?></p>
</div>
</div>
</article>
<?php endwhile; ?>
<div class="breadcrumb">
<div class="pull-left"><?php previous_post_link('&larr;&nbsp;%link'); ?></div>
<div class="pull-right"><?php next_post_link('%link&nbsp;&rarr;'); ?> </div>
<div class="clear"></div>
</div>
<div class="comments">
<?php comments_template(); ?>
</div>
<?php else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi('', '', '', '', 8, false);} ?>
</div>
<?php get_sidebar('short'); ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment