Skip to content
Browse files

Updated js for post format support.

  • Loading branch information...
1 parent 2d80fb7 commit 28c10b9b1f88fca2238bc6c7be016e97732887c5 @devinsays committed Jan 7, 2012
Showing with 151 additions and 21 deletions.
  1. +1 −0 changelog.txt
  2. +70 −0 content-gallery.php
  3. +34 −0 content-image.php
  4. +2 −2 functions.php
  5. +1 −1 header.php
  6. 0 { → js}/html5.js
  7. +0 −13 js/jquery.fader.js
  8. +1 −1 js/superfish.js
  9. +26 −0 js/theme.js
  10. +16 −4 style.css
View
1 changelog.txt
@@ -5,6 +5,7 @@ Portfolio Press 0.9
- Removed portfolio post type code
- Replaced portfolio taxonomy templates with archive-portfolio
- Renamed loop.php to content.php
+- Added post format support for quotes, images, and galleries
Portfolio Press 0.8
View
70 content-gallery.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ * @package WordPress
+ * @subpackage Portfolio Press
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+ <header class="entry-header">
+ <h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'portfoliopress' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
+ <div class="entry-meta">
+ <?php
+ printf( __( '<span class="meta-prep meta-prep-author">Posted on </span><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></a> <span class="meta-sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s">%6$s</a></span>', 'portfoliopress' ),
+ get_permalink(),
+ get_the_date( 'c' ),
+ get_the_date(),
+ get_author_posts_url( get_the_author_meta( 'ID' ) ),
+ sprintf( esc_attr__( 'View all posts by %s', 'portfoliopress' ), get_the_author() ),
+ get_the_author()
+ );
+ ?>
+ </div><!-- .entry-meta -->
+ </header><!-- .entry-header -->
+
+ <?php if ( is_archive() || is_search() ) : // Only display Excerpts for archives & search ?>
+ <div class="entry-summary">
+ <?php the_excerpt( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'portfoliopress' ) ); ?>
+ </div><!-- .entry-summary -->
+ <?php else : ?>
+ <div class="entry-content">
+ <?php if ( post_password_required() ) : ?>
+ <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'portfoliopress' ) ); ?>
+
+ <?php else : ?>
+ <?php
+ $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC' ) );
+ if ( $images ) :
+ $total_images = count( $images );
+ ?>
+
+ <figure class="gallery-thumb">
+ <?php
+ $i = 0;
+ foreach ($images as $image) {
+ $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
+ ?>
+ <a href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
+ <?php if (++$i == 3) break;
+ } ?>
+ </figure><!-- .gallery-thumb -->
+
+ <p><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, 'portfoliopress' ),
+ 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'portfoliopress' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
+ number_format_i18n( $total_images )
+ ); ?></em></p>
+ <?php endif; ?>
+ <?php the_excerpt(); ?>
+ <?php endif; ?>
+ <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'portfoliopress' ), 'after' => '</div>' ) ); ?>
+ </div><!-- .entry-content -->
+ <?php endif; ?>
+
+ <footer class="entry-meta">
+ <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'portfoliopress' ); ?></span><?php the_category( ', ' ); ?></span>
+ <span class="meta-sep"> | </span>
+ <?php the_tags( '<span class="tag-links">' . __( 'Tagged ', 'portfoliopress' ) . '</span>', ', ', '<span class="meta-sep"> | </span>' ); ?>
+ <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'portfoliopress' ), __( '1 Comment', 'portfoliopress' ), __( '% Comments', 'portfoliopress' ) ); ?></span>
+ <?php edit_post_link( __( 'Edit', 'portfoliopress' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
+ </footer><!-- #entry-meta -->
+</article><!-- #post-<?php the_ID(); ?> -->
View
34 content-image.php
@@ -0,0 +1,34 @@
+<?php
+/**
+ * @package WordPress
+ * @subpackage Portfolio Press
+ */
+?>
+
+<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
+
+ <header class="entry-header">
+ <h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'portfoliopress' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
+ </header>
+
+ <div class="entry-content">
+ <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'portfoliopress' ) ); ?>
+ <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'portfoliopress' ), 'after' => '</div>' ) ); ?>
+ </div><!-- .entry-content -->
+
+ <footer class="entry-meta">
+ <?php
+ printf( __( '<span class="meta-prep meta-prep-author">Posted on </span><a href="%1$s" rel="bookmark"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></a> <span class="meta-sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s">%6$s</a></span>', 'portfoliopress' ),
+ get_permalink(),
+ get_the_date( 'c' ),
+ get_the_date(),
+ get_author_posts_url( get_the_author_meta( 'ID' ) ),
+ sprintf( esc_attr__( 'View all posts by %s', 'portfoliopress' ), get_the_author() ),
+ get_the_author()
+ );
+ ?>
+ <span class="meta-sep"> | </span>
+ <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'portfoliopress' ), __( '1 Comment', 'portfoliopress' ), __( '% Comments', 'portfoliopress' ) ); ?></span>
+ <?php edit_post_link( __( 'Edit', 'portfoliopress' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
+ </footer><!-- #entry-meta -->
+</article><!-- #post-<?php the_ID(); ?> -->
View
4 functions.php
@@ -45,8 +45,8 @@ function portfoliopress_setup() {
// Enqueue javascript for the menu and portfolio items
if ( !is_admin() ) {
wp_enqueue_script( 'superfish', get_template_directory_uri() .'/js/superfish.js', array( 'jquery' ) );
- if ( !is_single() ) {
- wp_enqueue_script( 'fader', get_template_directory_uri() . '/js/jquery.fader.js', array( 'jquery' ) );
+ if ( !is_singular() ) {
+ wp_enqueue_script( 'themejs', get_template_directory_uri() . '/js/theme.js', array( 'jquery' ) );
}
}
View
2 header.php
@@ -34,7 +34,7 @@
<?php if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); ?>
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<!--[if lt IE 9]>
-<script src="<?php echo get_template_directory_uri(); ?>/html5.js"></script>
+<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js"></script>
<![endif]-->
<?php wp_head(); ?>
</head>
View
0 html5.js → js/html5.js
File renamed without changes.
View
13 js/jquery.fader.js
@@ -1,13 +0,0 @@
-jQuery(document).ready(function(){
-
-// Fade
- jQuery("#portfolio .title-overlay").css('opacity', 0.0); // Sets opacity to fade down to 0% when page loads
-
- jQuery("#portfolio .portfolio-item").hover(function(){
- jQuery(this).children(".title-overlay").stop(true).fadeTo(300, 1.0); // Sets 100% on hover
- jQuery(this).children(".thumb").stop(true).fadeTo(300, .5); // Sets 20% on hover
- },function(){
- jQuery(this).children(".title-overlay").stop(true).fadeTo(400, 0.0); // Sets opacity back to 0% on mouseout
- jQuery(this).children(".thumb").stop(true).fadeTo(1000, 1.0); // Sets opacity back to 100% on mouseout
- });
-});
View
2 js/superfish.js
@@ -121,4 +121,4 @@
jQuery(document).ready(function() {
jQuery('#navigation .menu ul').superfish();
-});
+});
View
26 js/theme.js
@@ -0,0 +1,26 @@
+jQuery(document).ready(function($){
+
+ // Portfolio Archive
+ $("#portfolio .title-overlay").css('opacity', 0.0); // Sets opacity to fade down to 0% when page loads
+ $("#portfolio .portfolio-item").hover(function(){
+ $(this).children(".title-overlay").stop(true).fadeTo(300, 1.0); // Sets 100% on hover
+ $(this).children(".thumb").stop(true).fadeTo(300, .5); // Sets 20% on hover
+ },function(){
+ $(this).children(".title-overlay").stop(true).fadeTo(400, 0.0); // Sets opacity back to 0% on mouseout
+ $(this).children(".thumb").stop(true).fadeTo(1000, 1.0); // Sets opacity back to 100% on mouseout
+ });
+
+ // Image Post Format
+ $('#content .format-image').each( function() {
+ var title = $(this).find('.entry-title').text();
+ $(this).find('img:first').wrap('<div class="image-wrap" />');
+ $(this).find('.image-wrap').append('<h3>' + title + '</h3>');
+ });
+
+ $('.format-image .image-wrap').hover( function() {
+ $(this).children('h3').slideDown(100);
+ }, function(){
+ $(this).children('h3').slideUp(200);
+ });
+
+});
View
20 style.css
@@ -1,6 +1,6 @@
/*
Theme Name: Portfolio Press
-Description: Portfolio Press an excellent theme for showcasing your photography, art, web sites, or other projects. It also works nicely as a regular blog site. An options panel is included for uploading logos and and changing the layout. For a video screencast showing how to set up the portfolio, visit http://wptheming.com/portfolio-theme.
+Description: Portfolio Press is an excellent theme for showcasing your photography, art, web sites, or other projects. It also works nicely as a regular blog site. An options panel is included for uploading logos and and changing the layout. There's also support for the image, gallery and quote post formats. Visit the <a href="http://themes.wptheming.com/portfolio/">demo site</a> or watch the <a href="http://wptheming.com/portfolio-theme">video screencast</a> for set up instructions.
Author: Devin Price
Author URI: http://wptheming.com/
Theme URI: http://wptheming.com/portfolio-theme/
@@ -14,9 +14,6 @@ Credits:
Portfolio was built on the solid foundation of Toolbox:
http://wordpress.org/extend/themes/toolbox
-Styles, especially the menus and buttons, were inspired by Canvas:
-http://www.woothemes.com/2010/02/canvas/
-
*/
/* Reset */
@@ -574,6 +571,21 @@ figure {
.single .format-image header {
display:block;
}
+.format-image .image-wrap {
+ position: relative;
+}
+.image-wrap h3 {
+ background:#000;
+ background:rgba(0,0,0,.6);
+ color:#fff;
+ padding:10px;
+ position:absolute;
+ bottom:13px;
+ left:6px;
+ width:610px;
+ display: none;
+ text-decoration: none;
+}
/* Portfolio Posts */

0 comments on commit 28c10b9

Please sign in to comment.
Something went wrong with that request. Please try again.