Skip to content

Commit

Permalink
Updated to version 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
cbavota committed Sep 1, 2011
1 parent 7da5cc4 commit ad79fdb
Show file tree
Hide file tree
Showing 14 changed files with 347 additions and 278 deletions.
11 changes: 11 additions & 0 deletions changelog.txt
@@ -1,5 +1,16 @@
PressWork Changelog

Version 1.0.3 09/01/2011
- Fix for webkit list issue
- Improved columns function
- Fixed syntax bug in site header
- Fixed width issue when adding sidebar
- Added home page action for featured/sticky query
- Changed slideshow image to full size
- Updated toolbox function for child theme support
- Added donate button to admin page
- Updated language files

Version 1.0.2 08/11/2011
- Updated code for child theme requirements
- Fixed missing textdomain on text elements
Expand Down
95 changes: 71 additions & 24 deletions presswork/admin/actions.php
Expand Up @@ -77,9 +77,9 @@ function pw_footer_content() {
function pw_sidebar() {
echo pw_function_handle(__FUNCTION__);
if(!dynamic_sidebar("first-sidebar")) :
echo '<div class="side-widget default">';
echo '<aside class="side-widget default">';
get_search_form();
echo '</div>';
echo '</aside>';

$args = array(
'before_widget' => '<aside class="side-widget default">',
Expand All @@ -97,9 +97,9 @@ function pw_sidebar() {
$tweet->widget($args, $instance);

if(current_user_can('edit_theme_options')) {
echo '<div class="warning clear fl"><p>';
echo '<aside class="warning clear fl"><p>';
printf(__("Add your own widgets to the First Sidebar %shere%s", "presswork"), '<a href="'.admin_url('widgets.php').'">', '</a>');
echo '</p></div>';
echo '</p></aside>';
}
endif;
}
Expand All @@ -111,9 +111,9 @@ function pw_sidebar() {
function pw_second_sidebar() {
echo pw_function_handle(__FUNCTION__);
if(!dynamic_sidebar("second-sidebar" ) && current_user_can('edit_theme_options')) :
echo '<div class="warning clear fl"><p>';
echo '<aside class="warning clear fl"><p>';
printf(__("Add widgets to the Second Sidebar %shere%s", "presswork"), '<a href="'.admin_url('widgets.php').'">', '</a>');
echo '</p></div>'; endif;
echo '</p></aside>'; endif;
}
add_action('pw_second_sidebar_middle', 'pw_second_sidebar');

Expand Down Expand Up @@ -162,14 +162,14 @@ function pw_pagination() {
function pw_404() {
echo pw_function_handle(__FUNCTION__);
?>
<div id="post-0" class="post error404 not-found">
<article id="post-0" class="post error404 not-found">
<header>
<h1 class="posttitle"><?php _e("Not found", "presswork"); ?></h1>
</header>
<div class="entry">
<p><?php _e("No results were found for your request.", "presswork"); ?></p>
</div>
</div>
</article>
<?php
}
add_action('pw_404_middle', 'pw_404');
Expand Down Expand Up @@ -306,6 +306,59 @@ function pw_search_title() {
}
add_action('pw_search_top', 'pw_search_title');

/*
* Home page featured query
*
* @since PressWork 1.0.3
*/
function pw_home_page_featured_query() {
global $post, $notin, $paged, $pw;
$pw = 1;
$sticky = get_option( 'sticky_posts' );
$notin = pw_notin();
if(!empty($sticky)) {
if(!empty($notin)) $notin = array_merge($notin, $sticky); else $notin = $sticky;
if($paged < 2) {
$args = array(
'post__in' => $sticky,
'ignore_sticky_posts' => 1
);
$the_query = new WP_Query( $args );
while ( $the_query->have_posts() ) : $the_query->the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class("pw pw".$pw); ?>>
<?php pw_actionBlock('pw_index_sticky_post'); ?>
</article>
<?php
$pw++;
endwhile;
wp_reset_query();
}
} else {
$args = array(
'post__not_in' => $notin,
'posts_per_page' => 2
);
$the_query = new WP_Query( $args );
while ( $the_query->have_posts() ) : $the_query->the_post();
if($paged < 2) {
$notin[] = $post->ID;
?>
<article id="post-<?php the_ID(); ?>" <?php post_class("pw pw".$pw); ?>>
<?php pw_actionBlock('pw_index_featured_post'); ?>
</article>
<?php
$pw++;
} else {
$notin[] = $post->ID;
}
endwhile;
wp_reset_query();
}
query_posts( array( 'post__not_in' => $notin, "paged" => $paged ) );
}
add_action('pw_home_page', 'pw_home_page_featured_query');

/*
* Featured posts
*/
Expand Down Expand Up @@ -352,7 +405,7 @@ function pw_posts_featured() {
$image_img_tag = wp_get_attachment_image( $image->ID, 'full' );
?>
<a class="gallery-thumb" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
<p class="gallery-text clear 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" ),
<p class="gallery-text clear 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>
Expand Down Expand Up @@ -422,7 +475,7 @@ function pw_posts() {
$image_img_tag = wp_get_attachment_image( $image->ID, 'full' );
?>
<a class="gallery-thumb" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
<p class="gallery-text clear 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" ),
<p class="gallery-text clear 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>
Expand Down Expand Up @@ -525,13 +578,11 @@ function pw_columns_post_title($r) {
<hgroup>
<h1 class="posttitle"><a href="<?php the_permalink() ?>" title="<?php printf(__("Permanent Link to %s", "presswork"), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a></h1>
<h2 class="meta">
<?php if(isset($r['authors'])) { echo '<div class="theauthor">'; _e("By", "presswork"); echo " "; the_author_posts_link(); echo '</div>'; } ?>
<?php if(isset($r['comments']) && comments_open()) { ?>
<div class="commentbox"><div class="commentbox-l"></div>
<?php comments_popup_link('0','1','%','ind-comments'); ?>
</div>
<?php } ?>
<?php if(isset($r['dates'])) { echo '<div class="thedate">'; the_time(get_option('date_format')); echo '</div>'; } ?>
<?php
if(isset($r['authors'])) { _e("by", "presswork"); echo " "; the_author_posts_link(); }
if(isset($r['dates'])) { echo '&nbsp;&bull;&nbsp;'; the_time(get_option('date_format')); }
if(isset($r['comments']) && comments_open()) { echo '&nbsp;&bull;&nbsp;'; comments_popup_link(__('0 Comments', "presswork"),__('1 Comment', "presswork"),__('% Comments', "presswork")); }
?>
</h2>
</hgroup>
</header>
Expand Down Expand Up @@ -559,7 +610,7 @@ function pw_columns_post_content($r) {
$image_img_tag = wp_get_attachment_image( $image->ID, 'full' );
?>
<a class="gallery-thumb" href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
<p class="gallery-text clear fl"><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, "presswork" ),
<p class="gallery-text clear 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>
Expand All @@ -577,11 +628,12 @@ function pw_columns_post_content($r) {
if($r['images']==1) {
if(function_exists('has_post_thumbnail') && has_post_thumbnail()) {
echo '<a href="'.get_permalink().'">';
the_post_thumbnail(array($r['img_w'], $r['img_h']), array('class'=>'alignright'));
the_post_thumbnail(array($r['img_w'], $r['img_h']), array('class'=>$r['img_float']));
echo '</a>';
}
}
the_excerpt();
if($r['readmore']==1) echo '<a href="'.get_permalink().'" class="more-link">'.__( 'Read more &rarr;', "presswork" ).'</a>';
}
}
?>
Expand All @@ -590,11 +642,6 @@ function pw_columns_post_content($r) {
}
add_action('pw_columns_middle', 'pw_columns_post_content', 1, 1);

function pw_columns_post_readmore($r) {
if($r['readmore']==1) echo '<a href="'.get_permalink().'" class="more-link">'.__( 'Read more &rarr;', "presswork" ).'</a>';
}
add_action('pw_columns_bottom', 'pw_columns_post_readmore', 1, 1);

// Including child theme action file
if(!defined('CHILD_ACTION_FILE'))
define('CHILD_ACTION_FILE', STYLESHEETPATH.'/actions.php');
Expand Down
1 change: 1 addition & 0 deletions presswork/admin/css/toolbox-styles.css
Expand Up @@ -581,6 +581,7 @@ div.handle {
z-index: 500;
color: #444;
font-size: 14px;
background: #f0f0f0;
}

#close-welcome:hover {
Expand Down
54 changes: 31 additions & 23 deletions presswork/admin/inc/columns.php
Expand Up @@ -9,71 +9,79 @@
* @since PressWork 1.0
*/
function pw_columns($args = '') {
global $pw_content_width;
global $pw_content_width, $paged;

$defaults = array(
'width' => 'full',
'columns' => 1,
'posts' => 1,
'text' => 'excerpt',
'readmore' => 1,
'category' => 'all',
'category' => 0,
'dates' => 1,
'authors' => 1,
'comments' => 1,
'images' => 1,
'img_w' => 100,
'img_h' => 100,
'margin-right' => '',
'img_float' => 'alignright',
'margin_right' => '',
'offset' => '',
'title' => '',
'id' => '',
'padding' => 15,
'padding' => 0,
'colmargin' => 30
);

$r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP );

$featuredcat = pw_theme_option('fp_featured');
$posts = array(
$post_query = array(
"posts_per_page"=>$r['posts'],
"ignore_sticky_posts" => 1,
'paged' => $paged
);
if($r['category']!="all")
$posts['cat'] = $r['category'];

if(isset($r['offset']))
$posts['offset'] = $r['offset'];
if($r['category']!=0)
$post_query['cat'] = $r['category'];

$column = new WP_Query();
$column->query($posts);
if(!empty($r['offset']))
$post_query['offset'] = $r['offset'];

if($r['width']=="full") {
$width = ' style="width:100%; margin-right:'.$r['margin-right'].'px;"';
if($r['columns']!=1) $col_width = ($pw_content_width - ($padding * 2 * $columns) - ($colmargin*($columns-1))) / $r['columns']; else $col_width = $pw_content_width - ($padding * 2);
$col_width = ' style="width: '.$col_width.'px;';
$width = ' style="width:100%;';
if(!empty($r['margin_right'])) $width .= ' margin-right:'.$r['margin_right'].'px;"'; else $width .= '"';
if($r['columns']!=1) $col_width = ($pw_content_width - ($colmargin*($columns-1))) / $r['columns']; else $col_width = $pw_content_width;
} else {
$width = ' style="width:'.$r['width'].'px; margin-right:'.$r['margin-right'].'px;"';
if($r['columns']!=1) $col_width = ($r['width'] - ($padding * 2 * $columns) - ($colmargin*($columns-1))) / $r['columns']; else $col_width = $r['width'] - ($padding * 2);
$col_width = ' style="width: '.$col_width.'px;';
$width = ' style="width:'.$r['width'].'px; margin-right:'.$r['margin_right'].'px;"';
if($r['columns']!=1) $col_width = ($r['width'] - ($colmargin*($columns-1))) / $r['columns']; else $col_width = $r['width'];
}
$col_width = ' style="width: '.$col_width.'px;';
if(!empty($padding)) $col_width .= ' padding: '.$padding.'px;';

$x=1;
if(!empty($r['id'])) {
$id = ' id="'.$r['id'].'"';
} else {
$id = "";
}

$column_query = new WP_Query();
$column_query->query($post_query);

?>
<div class="columns"<?php echo $width; echo $id; ?>>
<?php if(!empty($r['title'])) echo '<div class="columns-title">'.$r['title'].'</div>'; ?>
<?php while ($column->have_posts()) : $column->the_post(); ?>
<?php while ($column_query->have_posts()) : $column_query->the_post(); ?>
<?php if($x==1) $clear = "clear"; else $clear = ""; ?>
<?php if($x!=1 && $r['columns']>1) $final_width = $col_width.' margin-left: '.$colmargin.'px;"'; else $final_width = $col_width.'"'; ?>
<?php if($x==$r['columns']) $x=0; ?>
<div id="post-<?php the_ID(); ?>" <?php post_class($clear); echo $final_width; ?>>
<article id="post-<?php the_ID(); ?>" <?php post_class($clear); echo $final_width; ?>>
<?php pw_actionBlock('pw_columns', $r); ?>
</div>
</article>
<?php $x++; endwhile; ?>
</div>
<?php

}
endif;
endif;

2 changes: 1 addition & 1 deletion presswork/admin/inc/footer-scripts.php
Expand Up @@ -165,7 +165,7 @@ function(response){
loader.hide();
if(response) {
main.append(response);
var last = main.find("li:last");
var last = main.find("li#"+item);
if(wrap[1]=="layout") {
var newfull = last.outerWidth();
var full = $("#body-wrapper").outerWidth();
Expand Down
3 changes: 2 additions & 1 deletion presswork/admin/inc/slideshows.php
Expand Up @@ -36,6 +36,7 @@ function pw_slideshow($args = '') {
"ignore_sticky_posts" => 1
);
}

$featured = new WP_Query();
$featured->query($posts);
?>
Expand All @@ -47,7 +48,7 @@ function pw_slideshow($args = '') {
<?php
if(function_exists('has_post_thumbnail') && has_post_thumbnail()) {
echo '<a href="'.get_permalink().'">';
the_post_thumbnail(array($r['width'], $r['height']));
the_post_thumbnail('full');
echo '</a>';
}
?>
Expand Down
32 changes: 20 additions & 12 deletions presswork/admin/inc/toolbox.php
Expand Up @@ -67,18 +67,8 @@ function pw_toolbox() {
<div class="closewindow">X</div>
<div class="lower_box">
<div class="styled-select">
<select id="colorselect">
<option value="siteheader"><?php _e('Blog Name', "presswork"); ?></option>
<option value="description"><?php _e('Description', "presswork"); ?></option>
<option value="links"><?php _e('Links', "presswork"); ?></option>
<option value="text"><?php _e('Main Text', "presswork"); ?></option>
<option value="nav"><?php _e('Primary Nav Menu', "presswork"); ?></option>
<option value="subnav"><?php _e('Secondary Nav Menu', "presswork"); ?></option>
<option value="footernav"><?php _e('Footer Nav Menu', "presswork"); ?></option>
<option value="category_header"><?php _e('Category Header', "presswork"); ?></option>
<option value="post_title"><?php _e('Post Title', "presswork"); ?></option>
<option value="post_meta"><?php _e('Post Meta', "presswork"); ?></option>
<option value="page_background"><?php _e('Page Background', "presswork"); ?></option>
<select id="colorselect">
<?php pw_color_select_options(); ?>
</select>
</div>
<table class="themeoptions">
Expand Down Expand Up @@ -157,6 +147,24 @@ function pw_add_all_color_options() {
}
endif;

if(!function_exists('pw_color_select_options')) :
function pw_color_select_options() {
?>
<option value="siteheader"><?php _e('Blog Name', "presswork"); ?></option>
<option value="description"><?php _e('Description', "presswork"); ?></option>
<option value="links"><?php _e('Links', "presswork"); ?></option>
<option value="text"><?php _e('Main Text', "presswork"); ?></option>
<option value="nav"><?php _e('Primary Nav Menu', "presswork"); ?></option>
<option value="subnav"><?php _e('Secondary Nav Menu', "presswork"); ?></option>
<option value="footernav"><?php _e('Footer Nav Menu', "presswork"); ?></option>
<option value="category_header"><?php _e('Category Header', "presswork"); ?></option>
<option value="post_title"><?php _e('Post Title', "presswork"); ?></option>
<option value="post_meta"><?php _e('Post Meta', "presswork"); ?></option>
<option value="page_background"><?php _e('Page Background', "presswork"); ?></option>
<?php
}
endif;

if(!function_exists('pw_add_all_elements')) :
function pw_add_all_elements() {
?>
Expand Down
2 changes: 1 addition & 1 deletion presswork/admin/inc/widget-featured.php
Expand Up @@ -34,8 +34,8 @@ function widget($args, $instance) {
if(function_exists('has_post_format') && (has_post_format('aside') || has_post_format('link') || has_post_format('gallery'))) { // new aside || link post format
// do nothing
} else {
$rightcon = '';
if(function_exists('has_post_format') && !has_post_format('image')) {
$rightcon = '';
if(function_exists('has_post_thumbnail') && has_post_thumbnail()) {
echo '<a href="'.get_permalink().'">';
the_post_thumbnail('fifty', array('class'=>'alignleft'));
Expand Down
Binary file modified presswork/admin/languages/presswork.mo
Binary file not shown.

0 comments on commit ad79fdb

Please sign in to comment.