• PressWork v1.0.4 Release Candidate

    by  • January 17, 2012 • Blog • 11 Comments

    We have been working hard on getting things ready for version 1.0.4 and it is finally almost here. This version is our first release candidate and we wanted to share it with the community to get some feedback. Now things have changed quite a bit underneath the hood so we don’t suggest testing this out on a live site since most likely your child themes will need a little adjusting.

    Download PressWork v1.0.4 Release Candidate

    A New Loop

    The major changes in 1.0.4 are with the post loop in the actions.php file. The old loop was hard to customize so we decided to rewrite it from the ground up and separate it into some sections. First comes the header:

    /*
     * Post header
     */
    function pw_post_header() {
    	echo pw_function_handle(__FUNCTION__);
    	?>
    	<header>
    		<hgroup>
    			<h1 class="posttitle"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', "presswork" ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
    			<?php if(!is_page()) { ?>
    			<h2 class="meta">
    				<?php 
    				_e("by", "presswork"); echo " "; the_author_posts_link(); 
    				echo '&nbsp;&bull;&nbsp;';
    				the_time(get_option('date_format'));
    				if(!is_home()) {
    					echo '&nbsp;&bull;&nbsp;';
    					the_category(', ');
    				}
    				if(comments_open()) { echo '&nbsp;&bull;&nbsp;'; comments_popup_link(__('0 Comments', "presswork"),__('1 Comment', "presswork"),__('% Comments', "presswork")); }
    				?>
    			</h2>
    			<?php } ?>
    		</hgroup>
    	</header>
    	<?php
    }
    add_action('pw_archive_post_middle', 'pw_post_header', 10);
    add_action('pw_author_post_middle', 'pw_post_header', 10);
    add_action('pw_category_post_middle', 'pw_post_header', 10);
    add_action('pw_search_post_middle', 'pw_post_header', 10);
    add_action('pw_index_post_middle', 'pw_post_header', 10);
    add_action('pw_single_post_middle', 'pw_post_header', 10);
    add_action('pw_page_post_middle', 'pw_post_header', 10);

    Next comes the actual post content function:

    /*
     * Post content
     */
    function pw_post_content($ignore_image = false, $excerpt_length = 55, $hide_readmore = false, $display_excerpt = false) {
    	echo pw_function_handle(__FUNCTION__);
    	?>
        <div class="storycontent">
            <?php 
    		if(function_exists('has_post_format') && !is_singular()) {
    			$format = get_post_format();
    			if(empty($format) || has_post_format('image')) {
    				if(has_post_format('image')) $size = 'full'; elseif(empty($ignore_image)) $size = 'small'; else $size = 'thumbnail';
    				if(function_exists('has_post_thumbnail') && has_post_thumbnail()) {
    					if(empty($ignore_image)) {
    						echo '<a href="'.get_permalink().'" class="image-anchor">';
    						the_post_thumbnail($size, array( 'class' => 'alignleft' ));
    						echo '</a>';
    					}
    				} else {
    					if(has_post_format('image'))
    						the_content();
    				}
    				if(empty($format)) {
    					pw_excerpt($excerpt_length);
    					if(empty($hide_readmore)) echo '<a href="'.get_permalink().'" class="more-link">'.__('Read more &rarr;', "presswork").'</a>';
    				}	
    			} elseif(has_post_format('gallery')) { // new gallery post format
    				global $post;
    				$images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
    				if ( $images ) :
    					$total_images = count( $images );
    					$image = array_shift( $images );
    					$image_img_tag = wp_get_attachment_image( $image->ID, 'full' );
    				?>
    				<a class="gallery-thumb  img-shadow alignnone" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
    				<p class="gallery-text clearfix fl"><em><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo &rarr;</a>', 'This gallery contains <a %1$s>%2$s photos &rarr;</a>', $total_images, "presswork" ), 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', "presswork" ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
    						number_format_i18n( $total_images )
    					); ?></em>
    				</p>
    				<?php endif; ?>
    				<?php 
    			} else {
    				// new aside || link || audio || video || image post format
    	           	echo '<div class="pformat clearfix">';
    				the_content('');
    				echo '</div>';
    			}
    		} else {
    			if(!empty($display_excerpt))
    				pw_excerpt($excerpt_length);
    			else
    				the_content( __( 'Read more &rarr;', "presswork" ) );	
    		}
    		?>
        </div> 
    	<?php
    }
    add_action('pw_archive_post_middle', 'pw_post_content', 11);
    add_action('pw_author_post_middle', 'pw_post_content', 11);
    add_action('pw_category_post_middle', 'pw_post_content', 11);
    add_action('pw_search_post_middle', 'pw_post_content', 11);
    add_action('pw_index_post_middle', 'pw_post_content', 11);
    add_action('pw_single_post_middle', 'pw_post_content', 11);
    add_action('pw_page_post_middle', 'pw_post_content', 11);

    And finally the footer:

    /*
     * Post footer
     */
    function pw_post_footer() {
    	?>
         <footer class="clearfix fl">
    	    <?php
    	   	the_tags('<p class="tags"><small>'.__('Tags', "presswork").': ', ', ', '</small></p>');
    		wp_link_pages(array('before' => '<p><strong>'.__('Pages', "presswork").':</strong> ', 'after' => '</p>', 'next_or_number' => 'number'));
    		edit_post_link(__('(edit)', "presswork"), '<p class="clearfix">', '</p>');
    		?>
    	</footer> 
    	<?php
    }
    add_action('pw_single_post_middle', 'pw_post_footer', 12);
    add_action('pw_page_post_middle', 'pw_post_footer', 12);

    With this type of structure, you can easily customize elements without having to rewrite the entire function.

    Font Preview

    You will notice a new font preview in the PressWork Toolbox that makes it easier to see what fonts are available and how your site will look using each one. Thanks to Michal Bluma for contributing the code.

    Bug fixes galore

    When WordPress 3.3 was released, things got a little funky here and there with PressWork. We went through all of the code, rewriting things to improve efficiency and to debug common issue. Thanks to Michael Riethmuller for his multiple fixes on the toolbox.

    Release Candidate 01

    Please download PressWork v1.0.4 Release Candidate and test it out. If you encounter any issues, please report them on GitHub so we can do our best to get things perfect for the official release.

    About

    Senior Developer & Co-Founder of PressWork.

    http://bavotasan.com

    11 Responses to PressWork v1.0.4 Release Candidate

    1. January 17, 2012 at 5:32 pm

      Great work mate!
      Thanks a lot …

    2. Pingback: Cambios en la nueva versión PressWork 1.0.4 | SocialTotal

    3. January 18, 2012 at 11:31 am

      Using WordPress 3.3.1 on Centos 5 under Plesk 10.4.
      Twenty eleven theme active
      Installing PressWork 1.0.4

      Internal Server Error

      The server encountered an internal error or misconfiguration and was unable to complete your request.

      Please contact the server administrator,xx and inform them of the time the error occurred, and anything you might have done that may have caused the error.

      More information about this error may be available in the server error log.

      Apache Server at xxx.tld Port 80

      • January 18, 2012 at 12:49 pm

        Are you uploading PressWork through the WordPress Theme Uploader?

    4. Crislar
      January 19, 2012 at 5:58 pm

      It isn’t a presswork problem. I’m pretty sure now Ive explored it a bit further. Apologies for posting prematurely.

      I couldn’t install in wordpress dashboard except upload zip files. I changed hosting Php to FastCGI and now I can’t upload zip files but can now install from WordPress.org

      I hooked into 1.0.4 at the WordPress site this way and like what I see. Are you using a Grid (responsive) framework under the HTML 5?

      Still haven’t clue on why zip upload now fails 500 error. Its weird.
      Thanks!

      • January 20, 2012 at 10:57 am

        PW is built using responsive HTML5 & CSS3. It will fit perfectly on an iPad and iPhone.

    5. Pingback: We’re looking for a few good theme designers! | PressWork

    6. Jeff
      February 16, 2012 at 10:40 pm

      So when will the 104 version be available for the Presswork.me website?

    7. Mike
      February 21, 2012 at 6:01 pm

      There is a small bug in the css to properly support ie7 and 8

      #main-wrapper > li:nth-child(1) {
      margin-left:0 !important;
      }

      Should change to (or in addition):

      #main-wrapper > li:first-child {
      margin-left:0 !important;
      }

    8. March 16, 2012 at 10:50 pm

      when will the 104 version be available for the Presswork.me website?

    9. March 22, 2012 at 12:12 pm

      Can’t wait to try the new version… Hope the problem with the second sidebar is fixed.

    Leave a Reply

    Your email address will not be published. Required fields are marked *