Skip to content

Instantly share code, notes, and snippets.

@theshortcut
Created August 4, 2011 20:21
Show Gist options
  • Save theshortcut/1126148 to your computer and use it in GitHub Desktop.
Save theshortcut/1126148 to your computer and use it in GitHub Desktop.
unknownstudios sample
<?php
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'featured_artist',
array(
'labels' => array(
'name' => __( 'Featured Artists' ),
'singular_name' => __( 'Featured Artist' )
),
'public' => true,
'has_archive' => false,
'supports' => array (
'title',
'editor',
'custom-fields'
)
)
);
register_post_type( 'our_sounds',
array(
'labels' => array(
'name' => __( 'Our Sounds' ),
'singular_name' => __( 'Sound' )
),
'public' => true,
'has_archive' => false,
)
);
}
?>
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<title><?php bloginfo( 'name' ); ?><?php wp_title( '&mdash;' ); ?></title>
<link rel="stylesheet" href="<?php bloginfo( 'template_directory' ); ?>/js/libs/jplayer_assets/jplayer.blue.monday.css">
<link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<script src="<?php bloginfo( 'template_directory' ); ?>/js/libs/modernizr-1.7.min.js"></script>
</head>
<body <?php body_class(); ?>>
<div id="container">
<header>
<h1><?php bloginfo( 'name' ); ?></h1>
<h2><span><?php bloginfo( 'description' ); ?></span></h2>
<div id="contact">
<p>
Contact us:
<a class="facebook" href="http://facebook.com/OfficialBrandenSteineckert">Facebook</a>
<a class="email" href="mailto:801studios@gmail.com">eMail</a>
</p>
</div>
</header>
<div id="main" role="main">
<aside id="photos"></aside>
<section id="featured">
<h2>Featured Artist</h2>
<?php
$args = array( 'post_type' => 'featured_artist', 'posts_per_page' => 1 );
$loop = new WP_Query( $args );
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<h3><?php the_title() ?></h3>
<?php
$images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 1 ) );
if ( $images ) :
$total_images = count( $images );
$image = array_shift( $images );
$image_img_tag = wp_get_attachment_image( $image->ID, 'large' );
echo $image_img_tag;
endif;
?>
<?php the_excerpt() ?>
<?php
$songs = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'audio', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
if ( $songs ) :
foreach ( $songs as $song ) :?>
<a href="<?php echo wp_get_attachment_url( $song->ID ); ?>" class="song"><?php echo $song->post_title; ?></a>
<?php endforeach;
endif;
?>
<?php endwhile; ?>
<div id="jquery_jplayer_1" class="jp-jplayer"></div>
<div class="jp-audio">
<div class="jp-type-playlist">
<div id="jp_interface_1" class="jp-interface">
<ul class="jp-controls">
<li><a href="#" class="jp-play" tabindex="1">play</a></li>
<li><a href="#" class="jp-pause" tabindex="1">pause</a></li>
<li><a href="#" class="jp-stop" tabindex="1">stop</a></li>
<li><a href="#" class="jp-previous" tabindex="1">previous</a></li>
<li><a href="#" class="jp-next" tabindex="1">next</a></li>
</ul>
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time"></div>
<div class="jp-duration"></div>
</div>
<div id="jp_playlist_1" class="jp-playlist">
<ul>
<!-- The method Playlist.displayPlaylist() uses this unordered list -->
<li></li>
</ul>
</div>
</div>
</div>
<p class="links">
<?php
$custom_fields = get_post_custom($post->ID);
foreach ( $custom_fields as $key => $value ) {
if ( strpos( $value[0], 'http://' )!==false ) {
echo "<a href='" . $value[0] . "'>" . $key . "</a>";
}
}
?>
</p>
</section>
<section id="sounds">
<h2>Our Sounds</h2>
<?php
$args = array( 'post_type' => 'our_sounds', 'posts_per_page' => 1 );
$loop = new WP_Query( $args );
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php
$songs = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'audio', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
if ( $songs ) :
foreach ( $songs as $song ) :?>
<a href="<?php echo wp_get_attachment_url( $song->ID ); ?>" class="song"><?php echo $song->post_title; ?></a>
<?php endforeach;
endif;
?>
<div id="jquery_jplayer_2" class="jp-jplayer"></div>
<div class="jp-audio">
<div class="jp-type-playlist">
<div id="jp_interface_2" class="jp-interface">
<ul class="jp-controls">
<li><a href="#" class="jp-play" tabindex="1">play</a></li>
<li><a href="#" class="jp-pause" tabindex="1">pause</a></li>
<li><a href="#" class="jp-stop" tabindex="1">stop</a></li>
<li><a href="#" class="jp-previous" tabindex="1">previous</a></li>
<li><a href="#" class="jp-next" tabindex="1">next</a></li>
</ul>
<div class="jp-progress">
<div class="jp-seek-bar">
<div class="jp-play-bar"></div>
</div>
</div>
<div class="jp-current-time"></div>
<div class="jp-duration"></div>
</div>
<div id="jp_playlist_2" class="jp-playlist">
<ul>
<!-- The method Playlist.displayPlaylist() uses this unordered list -->
<li></li>
</ul>
</div>
</div>
</div>
<div id="send">
<?php the_content() ?>
</div>
<?php endwhile; ?>
</section>
</div>
</div> <!--! end of #container -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script>window.jQuery || document.write("<script src='<?php bloginfo( 'template_directory' ); ?>/js/libs/jquery-1.5.2.min.js'>\x3C/script>")</script>
<script src="<?php bloginfo( 'template_directory' ); ?>/js/libs/jquery.jplayer.min.js"></script>
<script src="<?php bloginfo( 'template_directory' ); ?>/js/script.js"></script>
</body>
</html>
$(document).ready(function(){
var Playlist = function(instance, playlist, options) {
var self = this;
this.instance = instance; // String: To associate specific HTML with this playlist
this.playlist = playlist; // Array of Objects: The playlist
this.options = options; // Object: The jPlayer constructor options for this playlist
this.current = 0;
this.cssId = {
jPlayer: "jquery_jplayer_",
interface: "jp_interface_",
playlist: "jp_playlist_"
};
this.cssSelector = {};
$.each(this.cssId, function(entity, id) {
self.cssSelector[entity] = "#" + id + self.instance;
});
if(!this.options.cssSelectorAncestor) {
this.options.cssSelectorAncestor = this.cssSelector.interface;
}
$(this.cssSelector.jPlayer).jPlayer(this.options);
$(this.cssSelector.interface + " .jp-previous").click(function() {
self.playlistPrev();
$(this).blur();
return false;
});
$(this.cssSelector.interface + " .jp-next").click(function() {
self.playlistNext();
$(this).blur();
return false;
});
};
Playlist.prototype = {
displayPlaylist: function() {
var self = this;
$(this.cssSelector.playlist + " ul").empty();
for (i=0; i < this.playlist.length; i++) {
var listItem = (i === this.playlist.length-1) ? "<li class='jp-playlist-last'>" : "<li>";
listItem += "<a href='#' id='" + this.cssId.playlist + this.instance + "_item_" + i +"' tabindex='1'>"+ this.playlist[i].name +"</a>";
// Create links to free media
if(this.playlist[i].free) {
var first = true;
listItem += "<div class='jp-free-media'>(";
$.each(this.playlist[i], function(property,value) {
if($.jPlayer.prototype.format[property]) { // Check property is a media format.
if(first) {
first = false;
} else {
listItem += " | ";
}
listItem += "<a id='" + self.cssId.playlist + self.instance + "_item_" + i + "_" + property + "' href='" + value + "' tabindex='1'>" + property + "</a>";
}
});
listItem += ")</span>";
}
listItem += "</li>";
// Associate playlist items with their media
$(this.cssSelector.playlist + " ul").append(listItem);
$(this.cssSelector.playlist + "_item_" + i).data("index", i).click(function() {
var index = $(this).data("index");
if(self.current !== index) {
self.playlistChange(index);
} else {
$(self.cssSelector.jPlayer).jPlayer("play");
}
$(this).blur();
return false;
});
// Disable free media links to force access via right click
if(this.playlist[i].free) {
$.each(this.playlist[i], function(property,value) {
if($.jPlayer.prototype.format[property]) { // Check property is a media format.
$(self.cssSelector.playlist + "_item_" + i + "_" + property).data("index", i).click(function() {
var index = $(this).data("index");
$(self.cssSelector.playlist + "_item_" + index).click();
$(this).blur();
return false;
});
}
});
}
}
},
playlistInit: function(autoplay) {
if(autoplay) {
this.playlistChange(this.current);
} else {
this.playlistConfig(this.current);
}
},
playlistConfig: function(index) {
$(this.cssSelector.playlist + "_item_" + this.current).removeClass("jp-playlist-current").parent().removeClass("jp-playlist-current");
$(this.cssSelector.playlist + "_item_" + index).addClass("jp-playlist-current").parent().addClass("jp-playlist-current");
this.current = index;
$(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]);
},
playlistChange: function(index) {
this.playlistConfig(index);
$(this.cssSelector.jPlayer).jPlayer("play");
},
playlistNext: function() {
var index = (this.current + 1 < this.playlist.length) ? this.current + 1 : 0;
this.playlistChange(index);
},
playlistPrev: function() {
var index = (this.current - 1 >= 0) ? this.current - 1 : this.playlist.length - 1;
this.playlistChange(index);
}
};
var featuredSongs = [];
$("#featured a.song").each(function(index) {
featuredSongs.push({name:$(this).text(), mp3:$(this).attr("href")});
});
var featuredPlaylist = new Playlist("1", featuredSongs, {
ready: function() {
featuredPlaylist.displayPlaylist();
featuredPlaylist.playlistInit(false);
},
ended: function() {
featuredPlaylist.playlistNext();
},
play: function() {
$(this).jPlayer("pauseOthers");
},
swfPath: "/wp-content/themes/unknownstudios/js/libs/jplayer_assets",
supplied: "mp3"
});
var ourSounds = [];
$("#sounds a.song").each(function(index) {
ourSounds.push({name:$(this).text(), mp3:$(this).attr("href")});
});
var soundsPlaylist = new Playlist("2", ourSounds, {
ready: function() {
soundsPlaylist.displayPlaylist();
soundsPlaylist.playlistInit(false);
},
ended: function() {
soundsPlaylist.playlistNext();
},
play: function() {
$(this).jPlayer("pauseOthers");
},
swfPath: "/wp-content/themes/unknownstudios/js/libs/jplayer_assets",
supplied: "mp3"
});
});
/*
Theme Name: Unknown Studios
Description: WordPress theme for Unknown Studios
Author: Clayton Ferris
Version: 1.0
*/
/**
* RESET
*/
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; }
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; }
blockquote, q { quotes: none; }
blockquote:before, blockquote:after,
q:before, q:after { content: ""; content: none; }
ins { background-color: #ff9; color: #000; text-decoration: none; }
table { border-collapse: collapse; border-spacing: 0; }
hr { display: block; height: 1px; border: 0; border-top: 1px solid #ccc; margin: 1em 0; padding: 0; }
a:hover, a:active { outline: none; }
ul, ol { margin-left: 2em; }
ol { list-style-type: decimal; }
nav ul, nav li { margin: 0; list-style:none; list-style-image: none; }
small { font-size: 85%; }
strong, th { font-weight: bold; }
td { vertical-align: top; }
/**
* Styles
*/
body, select, input, textarea {
background: hsl(57, 36%, 3%) url("img/bg.jpg") top center no-repeat;
background-attachment: fixed;
background-size: 1005px 100%;
-moz-background-size: 1005px 100%;
color: hsl(0, 0%, 100%);
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
font-weight: normal;
}
a, a:active, a:visited { color: hsl(0, 0%, 100%); }
a:hover { color: hsl(0, 0%, 100%); }
#container {
width: 900px;
margin: 0 auto;
overflow: hidden;
}
header {
position: relative;
padding: 20px 0 0 130px;
height: 160px;
}
header h1 {
text-indent: -999em;
overflow: hidden;
background: url("img/logo.png") no-repeat;
text-align: left;
direction: ltr;
width: 290px;
height: 170px;
position: absolute;
top: 0px;
left: 90px;
z-index: 3001;
}
header h2 {
background: hsl(198, 100%, 19%);
margin: 0;
padding: 10px 10px 10px 275px;
width: 465px;
-webkit-transform: rotate(1deg);
-moz-transform: rotate(1deg);
transform: rotate(1deg);
z-index: 3000;
}
#contact {
float: right;
padding: 20px 20px 0 0;
line-height: 27px;
}
#contact a.facebook, #contact a.email {
width: 27px;
height: 27px;
text-indent: -999em;
overflow: hidden;
display: inline-block;
text-align: left;
direction: ltr;
margin-left: 5px;
}
#contact a.facebook {
background: hsl(198, 100%, 19%) url("img/facebook.png") no-repeat;
}
#contact a.email {
background: hsl(198, 100%, 19%) url("img/email.png") no-repeat;
}
#photos {
float: left;
width: 207px;
height: 535px;
padding-right: 20px;
background: url("img/photos.png") top center no-repeat;
}
#featured {
float: left;
width: 305px;
padding: 12px;
margin-top: 72px;
background: hsl(198, 100%, 19%);
position: relative;
}
#featured h2 {
text-indent: -999em;
overflow: hidden;
background: url("img/featured.png") no-repeat;
text-align: left;
direction: ltr;
width: 286px;
height: 90px;
position: absolute;
top: -72px;
left: 13px;
}
#featured h3 {
font-size: 16px;
font-weight: bold;
padding: 5px 0;
}
#featured img {
width: 100%;
border: none;
}
#featured a.song {
display: none;
}
#featured p.links {
text-align: center;
}
#featured p.links a {
margin: 0 5px;
}
#featured p, #sounds p {
padding: 5px 0;
}
#sounds {
float: left;
padding: 85px 0 0 20px;
width: 305px;
position: relative;
}
#sounds h2 {
text-indent: -999em;
overflow: hidden;
background: url("img/sounds.png") no-repeat;
text-align: left;
direction: ltr;
width: 242px;
height: 101px;
position: absolute;
top: -10px;
left: 2px;
}
#sounds a.song {
display: none;
}
#send {
background: hsl(198, 100%, 19%) url("img/send.png") bottom left no-repeat;
padding: 10px;
margin-top: 10px;
}
div.jp-audio {
width: 305px;
overflow: hidden;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment