Skip to content

Commit

Permalink
4.00
Browse files Browse the repository at this point in the history
fixed mobile theme
fixed jetpack support
  • Loading branch information
jimo committed Mar 14, 2013
1 parent ddf8e9a commit 3f5cdec
Show file tree
Hide file tree
Showing 65 changed files with 899 additions and 613 deletions.
95 changes: 59 additions & 36 deletions functions.php
Expand Up @@ -458,7 +458,7 @@ function shiword_paged_navi() {
}

?>
<div class="<?php echo join( ' ', apply_filters( 'shiword_filter_navi_classes', array( 'navigate_comments' ) ) ); ?>">
<div class="navigate_comments hide-if-infinite">
<?php echo apply_filters( 'shiword_filter_paged_navi', $links ); ?>
</div>
<?php
Expand Down Expand Up @@ -1123,7 +1123,8 @@ function shiword_post_title( $args = '' ) {
}
}

// display post details

// print extra info for posts/pages
if ( !function_exists( 'shiword_post_details' ) ) {
function shiword_post_details( $args = '' ) {
global $post;
Expand All @@ -1134,49 +1135,71 @@ function shiword_post_details( $args = '' ) {
'tags' => 1,
'categories' => 1,
'avatar_size' => 48,
'featured' => 0
'featured' => 0,
'echo' => 1
);

$args = wp_parse_args( $args, $defaults );

?>
<?php if ( $args['featured'] && has_post_thumbnail( $post->ID ) ) { echo '<div class="sw-post-details-thumb">' . get_the_post_thumbnail( $post->ID, 'thumbnail' ) . '</div>'; } ?>
<?php if ( $args['author'] ) {
$author = $post->post_author;

$name = get_the_author_meta( 'nickname', $author );
$alt_name = get_the_author_meta( 'user_nicename', $author );
$avatar = get_avatar( $author, $args['avatar_size'], 'Gravatar Logo', $alt_name.'-photo' );
$description = get_the_author_meta( 'description', $author );
$author_link = get_author_posts_url( $author );

$author_network = '';
foreach( $contacts = shiword_new_contactmethods() as $key => $contact ) {
if ( get_the_author_meta( $key, $author ) )
$author_network .= '<a target="_blank" class="url" title="' . esc_attr( sprintf( __( 'follow %s on %s', 'shiword' ), $name, $contact ) ) . '" href="' . get_the_author_meta( $key, $author ) . '"><img alt="' . $key . '" width="24" height="24" src="' . get_template_directory_uri() . '/images/follow/' . $key . '.png" /></a>';
}
$tax_separator = apply_filters( 'shiword_filter_taxomony_separator', ', ' );

?>
<div class="sw-author-bio vcard">
<?php echo $avatar; ?>
<a class="fn author-name" href="<?php echo $author_link; ?>" ><?php echo $name; ?></a>
<?php if ( $description ) { ?><p class="author-description note"><?php echo $description; ?> </p><?php } ?>
<div class="fixfloat"></div>
<?php if ( $author_network ) { ?>
<p class="author-social">
<?php echo $author_network; ?>
</p>
<?php } ?>
</div>
<?php } ?>
<?php if ( $args['categories'] ) { echo __( 'Categories', 'shiword' ) . ': '; the_category( ', ' ); echo '<br>'; } ?>
<?php if ( $args['tags'] ) { echo __( 'Tags', 'shiword' ) . ': '; if ( !get_the_tags() ) { _e( 'No Tags', 'shiword' ); } else { the_tags( '', ', ', '' ); } echo '<br>'; } ?>
<?php if ( $args['date'] ) { printf( __( 'Published on: %1$s', 'shiword' ), get_the_time( get_option( 'date_format' ) ) ); } ?>
<?php
$output = '';

if ( $args['featured'] && has_post_thumbnail( $post->ID ) )
$output .= '<div class="tb-post-details post-details-thumb">' . get_the_post_thumbnail( $post->ID, 'thumbnail') . '</div>';

if ( $args['author'] )
$output .= shiword_author_badge( $post->post_author, $args['avatar_size'] );

if ( $args['categories'] )
$output .= '<div class="tb-post-details"><span class="post-details-cats">' . __( 'Categories', 'shiword' ) . ': </span>' . get_the_category_list( $tax_separator ) . '</div>';

if ( $args['tags'] )
$tags = get_the_tags() ? get_the_tag_list( '</span>', $tax_separator, '' ) : __( 'No Tags', 'shiword' ) . '</span>';
$output .= '<div class="tb-post-details"><span class="post-details-tags">' . __( 'Tags', 'shiword' ) . ': ' . $tags . '</div>';

if ( $args['date'] )
$output .= '<div class="tb-post-details"><span class="post-details-date">' . __( 'Published on', 'shiword' ) . ': </span><a href="' . get_day_link(get_the_time('Y'), get_the_time('m'), get_the_time('d')) . '">' . get_the_time( get_option( 'date_format' ) ) . '</a></div>';

if ( ! $args['echo'] )
return $output;

echo $output;

}
}


// get the author badge
function shiword_author_badge( $author = '', $size ) {

if ( ! $author ) return;

$name = get_the_author_meta( 'nickname', $author ); // nickname

$avatar = get_avatar( $author, $size, 'Gravatar Logo', get_the_author_meta( 'user_nicename', $author ) . '-photo' ); // gravatar

$description = get_the_author_meta( 'description', $author ); // bio

$author_link = get_author_posts_url($author); // link to author posts

$author_net = ''; // author social networks
foreach ( array( 'twitter' => 'Twitter', 'facebook' => 'Facebook', 'googleplus' => 'Google+' ) as $s_key => $s_name ) {
if ( get_the_author_meta( $s_key, $author ) ) $author_net .= '<a target="_blank" class="url" title="' . esc_attr( sprintf( __('Follow %s on %s', 'shiword'), $name, $s_name ) ) . '" href="'.get_the_author_meta( $s_key, $author ).'"><img alt="' . $s_key . '" class="social-icon" width="24" height="24" src="' . get_template_directory_uri() . '/images/follow/' . $s_key . '.png" /></a>';
}

$output = '<li class="author-avatar">' . $avatar . '</li>';
$output .= '<li class="author-name"><a class="fn" href="' . $author_link . '" >' . $name . '</a></li>';
$output .= $description ? '<li class="author-description note">' . $description . '</li>' : '';
$output .= $author_net ? '<li class="author-social">' . $author_net . '</li>' : '';

$output = '<div class="tb-post-details tb-author-bio vcard"><ul>' . $output . '</ul></div>';

return apply_filters( 'shiword_filter_author_badge', $output );

}


// theme credits
if ( !function_exists( 'shiword_theme_credits' ) ) {
function shiword_theme_credits() {
Expand Down
Binary file modified images/follow/blogger.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/blurb.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/bookmarks.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/buzz.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/delicious.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/deviantart.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/digg.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/dropbox.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/facebook.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/flickr.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/github.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/googleplus.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/hi5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/linkedin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/mail.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/myspace.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/odnoklassniki.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/orkut.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/picasa.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/pinterest.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/qzone.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/reddit.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/rss.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/scribd.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/slideshare.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/follow/soundcloud.png
Binary file modified images/follow/stumbleupon.png
Binary file modified images/follow/technorati.png
Binary file modified images/follow/tencent.png
Binary file modified images/follow/tumblr.png
Binary file modified images/follow/twitter.png
Binary file modified images/follow/ubuntuone.png
Binary file modified images/follow/vimeo.png
Binary file modified images/follow/vkontakte.png
Binary file modified images/follow/weibo.png
Binary file modified images/follow/windowslive.png
Binary file modified images/follow/xing.png
Binary file modified images/follow/yfrog.png
Binary file modified images/follow/youtube.png
122 changes: 71 additions & 51 deletions lib/jetpack.php
Expand Up @@ -9,80 +9,100 @@
*/


add_action( 'init', 'shiword_for_jetpack_init' ); //Jetpack support
class Shiword_For_Jetpack {

add_action( 'infinite_scroll_render', 'shiword_infinite_scroll_pageinfo' ); // page reminder
function __construct () {

add_action( 'init', array( $this, 'init' ) ); //Jetpack support

/* initialize Jetpack support */
function shiword_for_jetpack_init() {
}

//Infinite Scroll
add_theme_support( 'infinite-scroll', array(
'type' => 'click',
'container' => 'posts-container',
'render' => 'shiword_for_jetpack_infinite_scroll',
) );
if ( class_exists( 'The_Neverending_Home_Page' ) )
add_filter( 'shiword_filter_navi_classes', 'shiword_for_jetpack_infinite_scroll_navigation' );

//Sharedaddy
if ( function_exists( 'sharing_display' ) ) {
remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );
remove_action( 'shiword_hook_like_it', 'shiword_like_it' );
add_action( 'shiword_hook_like_it', 'shiword_for_jetpack_sharedaddy' );
}
/* initialize Jetpack support */
function init() {

if ( shiword_is_mobile() ) return;

//Infinite Scroll
add_theme_support( 'infinite-scroll', array(
'type' => 'click',
'container' => 'posts-container',
'render' => array( $this, 'infinite_scroll_render' ),
) );
if ( class_exists( 'The_Neverending_Home_Page' ) ) {
add_filter( 'infinite_scroll_results', array( $this, 'infinite_scroll_encode' ), 11, 1 );
}

//Sharedaddy
if ( function_exists( 'sharing_display' ) ) {
remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );
remove_action( 'shiword_hook_like_it', 'shiword_like_it' );
add_action( 'shiword_hook_like_it', array( $this, 'sharedaddy' ) );
}

//Carousel
if ( class_exists( 'Jetpack_Carousel' ) ) {
remove_filter( 'post_gallery', 'shiword_gallery_shortcode', 10, 2 );
add_filter( 'shiword_filter_js_modules', array( $this, 'carousel' ) );
}

//Likes
if ( class_exists( 'Jetpack_Likes' ) ) {
add_filter( 'wpl_is_index_disabled', '__return_false' );
}

//Carousel
if ( class_exists( 'Jetpack_Carousel' ) ) {
remove_filter( 'post_gallery', 'shiword_gallery_shortcode', 10, 2 );
add_filter( 'shiword_filter_js_modules', 'shiword_for_jetpack_carousel' );
}

//Likes
if ( class_exists( 'Jetpack_Likes' ) ) {
add_filter( 'wpl_is_index_disabled', '__return_false' );

//Set the code to be rendered on for calling posts,
function infinite_scroll_render() {

$page = (int) $_GET['page'] + 1;
echo '<div class="page-reminder"><span>' . $page . '</span></div>';

get_template_part( 'loop' );

}

}

//Set the code to be rendered on for calling posts,
function shiword_for_jetpack_infinite_scroll() {
//print page number reminder
function infinite_scroll_navigation( $classes ) {

get_template_part( 'loop' );
$classes[] = 'hide-if-js';
return $classes;

}
}

//print page number reminder
function shiword_infinite_scroll_pageinfo() {

$page = (int) $_GET['page'] + 1;
echo '<div class="page-reminder"><span>' . $page . '</span></div>';
//encodes html result to UTF8 (jetpack bug?)
//http://localhost/wordpress/?infinity=scrolling&action=infinite_scroll&page=5&order=DESC
function infinite_scroll_encode( $results ) {

}
$results['html'] = utf8_encode( utf8_decode( $results['html'] ) );
return $results;

}

//print page number reminder
function shiword_for_jetpack_infinite_scroll_navigation( $classes ) {

$classes[] = 'hide-if-js';
return $classes;
//print the sharedaddy buttons inside the "I-like-it" container instead of after post content
function sharedaddy() {

}
$text = sharing_display();
if ( $text )
echo '<div class="sw-I-like-it">' . $text . '<div class="fixfloat"> </div></div>';

//print the sharedaddy buttons inside the "I-like-it" container instead of after post content
function shiword_for_jetpack_sharedaddy() {
}

$text = sharing_display();
if ( $text )
echo '<div class="sw-I-like-it">' . $text . '<div class="fixfloat"> </div></div>';

}
//skip the thickbox js module
function carousel( $modules ) {

//skip the thickbox js module
function shiword_for_jetpack_carousel( $modules ) {
$modules = str_replace( 'thickbox', 'carousel', $modules );
return $modules;

$modules = str_replace( 'thickbox', 'carousel', $modules );
return $modules;
}

}

new Shiword_For_Jetpack;

0 comments on commit 3f5cdec

Please sign in to comment.