Skip to content

Commit

Permalink
Loads of fun, new stuff. Plus, random backgrounds.
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Tadlock committed Sep 4, 2012
1 parent 300007f commit e3fb7cf
Show file tree
Hide file tree
Showing 23 changed files with 1,042 additions and 47 deletions.
55 changes: 55 additions & 0 deletions content-aside.php
@@ -0,0 +1,55 @@
<?php
/**
* Aside Content Template
*
* Template used to show posts with the 'aside' post format.
*
* @package Unique
* @subpackage Template
* @since 0.1.0
* @author Justin Tadlock <justin@justintadlock.com>
* @copyright Copyright (c) 2012, Justin Tadlock
* @link http://themeforest.net/user/greenshady
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/

do_atomic( 'before_entry' ); // unique_before_entry ?>

<article id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">

<?php do_atomic( 'open_entry' ); // unique_open_entry ?>

<?php if ( is_singular() && is_main_query() ) { ?>

<header class="entry-header">
<?php echo apply_atomic_shortcode( 'entry_title', the_title( '<h1 class="entry-title">', '</h1>', false ) ); ?>
<?php echo apply_atomic_shortcode( 'byline', '<div class="byline">' . __( '[post-format-link] published on [entry-published] [entry-edit-link before="| "]', 'unique' ) . '</div>' ); ?>
</header><!-- .entry-header -->

<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'unique' ), 'after' => '</p>' ) ); ?>
</div><!-- .entry-content -->

<footer class="entry-footer">
<?php echo apply_atomic_shortcode( 'entry_meta', '<div class="entry-meta">' . __( '[entry-terms taxonomy="category" before="Posted in "] [entry-terms before="Tagged "]', 'unique' ) . '</div>' ); ?>
</footer><!-- .entry-footer -->

<?php } else { ?>

<div class="entry-content">
<?php the_content( __( 'Read more &rarr;', 'unique' ) ); ?>
<?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'unique' ), 'after' => '</p>' ) ); ?>
</div><!-- .entry-content -->

<footer class="entry-footer">
<?php echo apply_atomic_shortcode( 'entry_meta', '<div class="entry-meta">' . __( '[post-format-link] published on [entry-published] [entry-permalink before="| "] [entry-comments-link before="| "] [entry-edit-link before="| "]', 'unique' ) . '</div>' ); ?>
</footer>

<?php } ?>

<?php do_atomic( 'close_entry' ); // unique_close_entry ?>

</article><!-- .hentry -->

<?php do_atomic( 'after_entry' ); // unique_after_entry ?>
55 changes: 55 additions & 0 deletions content-quote.php
@@ -0,0 +1,55 @@
<?php
/**
* Quote Content Template
*
* Template used to show posts with the 'quote' post format.
*
* @package Unique
* @subpackage Template
* @since 0.1.0
* @author Justin Tadlock <justin@justintadlock.com>
* @copyright Copyright (c) 2012, Justin Tadlock
* @link http://themeforest.net/user/greenshady
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/

do_atomic( 'before_entry' ); // unique_before_entry ?>

<article id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">

<?php do_atomic( 'open_entry' ); // unique_open_entry ?>

<?php if ( is_singular() && is_main_query() ) { ?>

<header class="entry-header">
<?php echo apply_atomic_shortcode( 'entry_title', the_title( '<h1 class="entry-title">', '</h1>', false ) ); ?>
<?php echo apply_atomic_shortcode( 'byline', '<div class="byline">' . __( '[post-format-link] published on [entry-published] [entry-edit-link before="| "]', 'unique' ) . '</div>' ); ?>
</header><!-- .entry-header -->

<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'unique' ), 'after' => '</p>' ) ); ?>
</div><!-- .entry-content -->

<footer class="entry-footer">
<?php echo apply_atomic_shortcode( 'entry_meta', '<div class="entry-meta">' . __( '[entry-terms taxonomy="category" before="Posted in "] [entry-terms before="Tagged "]', 'unique' ) . '</div>' ); ?>
</footer><!-- .entry-footer -->

<?php } else { ?>

<div class="entry-content">
<?php the_content( __( 'Read more &rarr;', 'unique' ) ); ?>
<?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'unique' ), 'after' => '</p>' ) ); ?>
</div><!-- .entry-content -->

<footer class="entry-footer">
<?php echo apply_atomic_shortcode( 'entry_meta', '<div class="entry-meta">' . __( '[post-format-link] published on [entry-published] [entry-permalink before="| "] [entry-comments-link before="| "] [entry-edit-link before="| "]', 'unique' ) . '</div>' ); ?>
</footer>

<?php } ?>

<?php do_atomic( 'close_entry' ); // unique_close_entry ?>

</article><!-- .hentry -->

<?php do_atomic( 'after_entry' ); // unique_after_entry ?>
71 changes: 71 additions & 0 deletions content-video.php
@@ -0,0 +1,71 @@
<?php
/**
* Video Content Template
*
* Template used to show posts with the 'image' post format.
*
* @package Unique
* @subpackage Template
* @since 0.1.0
* @author Justin Tadlock <justin@justintadlock.com>
* @copyright Copyright (c) 2012, Justin Tadlock
* @link http://themeforest.net/user/greenshady
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/

do_atomic( 'before_entry' ); // unique_before_entry ?>

<article id="post-<?php the_ID(); ?>" class="<?php hybrid_entry_class(); ?>">

<?php do_atomic( 'open_entry' ); // unique_open_entry ?>

<?php if ( is_singular() && is_main_query() ) { ?>

<header class="entry-header">
<?php echo apply_atomic_shortcode( 'entry_title', the_title( '<h1 class="entry-title">', '</h1>', false ) ); ?>
<?php echo apply_atomic_shortcode( 'byline', '<div class="byline">' . __( '[post-format-link] published on [entry-published] [entry-comments-link before=" | "] [entry-edit-link before=" | "]', 'unique' ) . '</div>' ); ?>
</header><!-- .entry-header -->

<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'unique' ), 'after' => '</p>' ) ); ?>
</div><!-- .entry-content -->

<footer class="entry-footer">
<?php echo apply_atomic_shortcode( 'entry_meta', '<div class="entry-meta">' . __( '[entry-terms taxonomy="category" before="Posted in "] [entry-terms before="Tagged "]', 'unique' ) . '</div>' ); ?>
</footer><!-- .entry-footer -->

<?php } else { ?>

<header class="entry-header">
<?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?>
</header><!-- .entry-header -->

<?php echo ( $video = just_me_get_video_embed() ); ?>

<?php if ( has_excerpt() ) { ?>

<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->

<?php } elseif ( empty( $video ) ) { ?>

<div class="entry-content">
<?php the_content( __( 'Read more &rarr;', 'unique' ) ); ?>
<?php wp_link_pages( array( 'before' => '<p class="page-links">' . __( 'Pages:', 'unique' ), 'after' => '</p>' ) ); ?>
</div><!-- .entry-content -->

<?php } ?>

<footer class="entry-footer">
<?php echo apply_atomic_shortcode( 'entry_meta', '<div class="entry-meta">' . __( '[post-format-link] published on [entry-published] [entry-permalink before="| "] [entry-comments-link before="| "] [entry-edit-link before="| "]', 'unique' ) . '</div>' ); ?>
</footer><!-- .entry-footer -->

<?php } ?>

<?php do_atomic( 'close_entry' ); // unique_close_entry ?>

</article><!-- .hentry -->

<?php do_atomic( 'after_entry' ); // unique_after_entry ?>
2 changes: 1 addition & 1 deletion content.php
Expand Up @@ -38,7 +38,7 @@
<?php } else { ?>

<header class="entry-header">
<?php echo apply_atomic_shortcode( 'entry_title', the_title( '<h2 class="entry-title"><a href="' . get_permalink() . '">', '</a></h2>', false ) ); ?>
<?php echo apply_atomic_shortcode( 'entry_title', '[entry-title]' ); ?>
<?php echo apply_atomic_shortcode( 'byline', '<div class="byline">' . __( 'Article published on [entry-published] [entry-comments-link before=" | "] [entry-edit-link before=" | "]', 'my-life' ) . '</div>' ); ?>
</header><!-- .entry-header -->

Expand Down
4 changes: 2 additions & 2 deletions footer.php
Expand Up @@ -33,6 +33,8 @@

<div class="wrap">

<?php get_template_part( 'menu', 'subsidiary' ); // Loads the menu-subsidiary.php template. ?>

<div class="footer-content">
<?php hybrid_footer_content(); ?>
</div><!-- .footer-content -->
Expand All @@ -47,8 +49,6 @@

<?php do_atomic( 'after_footer' ); // my-life_after_footer ?>

<?php get_template_part( 'menu', 'subsidiary' ); // Loads the menu-subsidiary.php template. ?>

</div><!-- #container -->

<?php do_atomic( 'close_body' ); // my-life_close_body ?>
Expand Down
114 changes: 114 additions & 0 deletions functions.php
Expand Up @@ -9,15 +9,61 @@ function just_me_theme_setup() {

$prefix = hybrid_get_prefix();

hybrid_set_content_width( 780 );

//add_theme_support( 'hybrid-core-sidebars', array( 'primary' ) );
add_theme_support( 'hybrid-core-menus', array( 'primary', 'subsidiary' ) );
add_theme_support( 'hybrid-core-shortcodes' );
add_theme_support( 'hybrid-core-theme-settings', array( 'about', 'footer' ) );

//add_theme_support( 'breadcrumb-trail' );
add_theme_support( 'get-the-image' );
add_theme_support( 'cleaner-caption' );


$dir = trailingslashit( get_template_directory_uri() ) . 'images/backgrounds';
add_theme_support(
'random-custom-background', // Wrapper for 'custom-background'.
array(
array( 'image' => "{$dir}/bg-yellow-stripe.png" ),
array( 'image' => "{$dir}/bg-autumnish-stripe.png" ),
array( 'image' => "{$dir}/bg-plaid-green.png" ),
array( 'image' => "{$dir}/bg-war-eagle-primary.png" ), // War Eagle! @link http://www.auburn.edu/template/colors.html
array( 'image' => "{$dir}/bg-war-eagle-secondary.png" ),
array( 'image' => "{$dir}/bg-fall-leaves-stripe.png" ),
array( 'image' => "{$dir}/bg-candy-cane-diagonal.png", 'color' => 'fff' ),
array( 'image' => "{$dir}/bg-by-plaid.png" )
)
);

require_once( trailingslashit( THEME_DIR ) . 'random-custom-background.php' );

add_theme_support( 'custom-header', array( 'random-default' => true, 'width' => 100, 'height' => 100 ) );

add_theme_support( 'post-formats', array( 'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' ) );

add_action( 'wp_enqueue_scripts', 'just_me_enqueue_scripts' );

add_filter( 'the_content', 'my_link_format_make_clickable', 99 );

add_filter( "{$prefix}_default_theme_settings", 'just_me_default_settings' );
}

function just_me_default_settings( $settings ) {

/* If there is a child theme active, add the [child-link] shortcode to the $footer_insert. */
if ( is_child_theme() )
$settings['footer_insert'] = '<p class="credit">' . __( 'Powered by [wp-link], [theme-link], and [child-link].', 'just-me' ) . '</p>';

/* If no child theme is active, leave out the [child-link] shortcode. */
else
$settings['footer_insert'] = '<p class="credit">' . __( 'Powered by [wp-link] and [theme-link].', 'just-me' ) . '</p>';

return $settings;
}

function just_me_enqueue_scripts() {
wp_enqueue_script( hybrid_get_prefix(), trailingslashit( THEME_URI ) . 'js/just-me.js', array( 'jquery' ), '20120901', true );
}

function my_link_format_make_clickable( $content ) {
Expand Down Expand Up @@ -57,14 +103,82 @@ function just_me_wp_widgets_ui_fail() {
}


function just_me_get_video_embed() {
global $wp_embed;

/* If this is not a 'video' post, return. */
if ( !has_post_format( 'video' ) )
return false;

/* Get the post content. */
$content = get_the_content();

/* Set the default $embed variable to false. */
$embed = false;

/* Use WP's built in WP_Embed class methods to handle the dirty work. */
add_filter( 'just_me_video_shortcode_embed', array( $wp_embed, 'run_shortcode' ) );
add_filter( 'just_me_video_auto_embed', array( $wp_embed, 'autoembed' ) );

/* We don't want to return a link when an embed doesn't work. Filter this to return false. */
add_filter( 'embed_maybe_make_link', '__return_false' );

/* Check for matches against the [embed] shortcode. */
preg_match_all( '|\[embed.*?](.*?)\[/embed\]|i', $content, $matches, PREG_SET_ORDER );

/* If matches were found, loop through them to see if we can hit the jackpot. */
if ( is_array( $matches ) ) {
foreach ( $matches as $value ) {

/* Apply filters (let WP handle this) to get an embedded video. */
$embed = apply_filters( 'just_me_video_shortcode_embed', '[embed]' . $value[1]. '[/embed]' );

/* If no embed, continue looping through the array of matches. */
if ( empty( $embed ) )
continue;
}
}

/* If no embed at this point and the user has 'auto embeds' turned on, let's check for URLs in the post. */
if ( empty( $embed ) && get_option( 'embed_autourls' ) ) {
preg_match_all( '|^\s*(https?://[^\s"]+)\s*$|im', $content, $matches, PREG_SET_ORDER );

/* If URL matches are found, loop through them to see if we can get an embed. */
if ( is_array( $matches ) ) {
foreach ( $matches as $value ) {

/* Let WP work its magic with the 'autoembed' method. */
$embed = apply_filters( 'just_me_video_auto_embed', $value[0] );

/* If no embed, continue looping through the array of matches. */
if ( empty( $embed ) )
continue;
}
}
}

/* Remove the maybe make link filter. */
remove_filter( 'embed_maybe_make_link', '__return_false' );

/* Return the embed. */
return $embed;
}

add_filter( 'previous_posts_link_attributes', 'just_me_previous_posts_link_attributes' );
add_filter( 'next_posts_link_attributes', 'just_me_next_posts_link_attributes' );

function just_me_previous_posts_link_attributes( $attr ) {

$attr .= ' rel="prev"';

return $attr;
}

function just_me_next_posts_link_attributes( $attr ) {

$attr .= ' rel="next"';

return $attr;
}

?>
8 changes: 5 additions & 3 deletions header.php
Expand Up @@ -48,17 +48,19 @@
<h2 id="site-description"><?php bloginfo( 'description' ); ?></h2>
</hgroup><!-- #branding -->

<?php get_template_part( 'menu', 'primary' ); // Loads the menu-primary.php template. ?>

<?php do_atomic( 'header' ); // my-life_header ?>

</header><!-- .wrap -->
</div><!-- .wrap -->

<?php do_atomic( 'close_header' ); // my-life_close_header ?>

</div><!-- #header -->
</header><!-- #header -->

<?php do_atomic( 'after_header' ); // my-life_after_header ?>

<?php get_template_part( 'menu', 'primary' ); // Loads the menu-primary.php template. ?>
<?php //get_search_form(); // Loads the search form. */ ?>

<?php if ( get_header_image() ) echo '<img class="header-image" src="' . get_header_image() . '" alt="" />'; ?>

Expand Down
Binary file added images/backgrounds/bg-autumnish-stripe.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/backgrounds/bg-by-plaid.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/backgrounds/bg-candy-cane-diagonal.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/backgrounds/bg-fall-leaves-stripe.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/backgrounds/bg-plaid-green.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/backgrounds/bg-war-eagle-primary.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/backgrounds/bg-war-eagle-secondary.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added images/q.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e3fb7cf

Please sign in to comment.