boozurk_get_js_modules(), 'script_modules_afterajax' => boozurk_get_js_modules(1), 'post_expander' => esc_js( __( 'Post loading, please wait...','boozurk' ) ), 'gallery_preview' => esc_js( __( 'Preview','boozurk' ) ), 'gallery_click' => esc_js( __( 'Click on thumbnails','boozurk' ) ), 'infinite_scroll' => esc_js( __( 'Page is loading, please wait...','boozurk' ) ), 'infinite_scroll_end' => esc_js( __( 'No more posts beyond this line','boozurk' ) ), 'infinite_scroll_type' => boozurk_get_opt( 'boozurk_infinite_scroll_type' ), 'quote_tip' => esc_js( __( 'Add selected text as a quote', 'boozurk' ) ), 'quote' => esc_js( __( 'Quote', 'boozurk' ) ), 'quote_alert' => esc_js( __( 'Nothing to quote. First of all you should select some text...', 'boozurk' ) ), 'comments_closed' => esc_js( __( 'Comments closed', 'boozurk' ) ), ); wp_localize_script( 'boozurk-script', 'boozurk_l10n', $data ); } } // post-top date, tags and categories function boozurk_print_details() { if ( is_singular() ) return; echo ''; } // display the post title with the featured image if ( !function_exists( 'boozurk_featured_title' ) ) { function boozurk_featured_title( $args = '' ) { global $post; $defaults = array( 'alternative' => '', 'fallback' => '', 'featured' => true, 'href' => get_permalink(), 'target' => '', 'title' => the_title_attribute( array('echo' => 0 ) ), ); $args = wp_parse_args( $args, $defaults ); $post_title = $args['alternative'] ? $args['alternative'] : get_the_title(); $post_title = $post_title ? $post_title : $args['fallback']; $link_target = $args['target'] ? ' target="'.$args['target'].'"' : ''; $title_content = is_singular() ? $post_title : '' . $post_title . ''; if ( $post_title ) $post_title = '

' . $title_content . '

'; if ( is_front_page() && get_option('show_on_front') == "page" ) $post_title = ''; switch ( boozurk_get_opt( 'boozurk_featured_title' ) ) { case 'none': $args['featured'] = false; break; case 'lists': if ( is_singular() ) $args['featured'] = false; break; case 'single': if ( !is_singular() ) $args['featured'] = false; break; } $thumb = false; if ( $args['featured'] && has_post_thumbnail( $post->ID ) ) { if ( boozurk_get_opt( 'boozurk_featured_title_thumb' ) == 'large') { $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); if ( $image[1] >= 900 ) $thumb = get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); } else { $thumb = get_the_post_thumbnail( $post->ID, 'thumbnail' ); } } // Check if this is a post or page, if it has a thumbnail, and if it's a big one if ( $thumb ) { ?> 1, 'comments' => 1, 'plusone' => 1, ); $args = wp_parse_args( $args, $defaults ); ?>
' ); ?>
ID; $comments = get_comments( 'status=approve&number=' . $num . '&type=comment&post_id=' . $id ); // valid type values (not documented) : 'pingback','trackback','comment' $ellipsis = ''; if ( count( $comments ) > 5 ) { $ellipsis = '...'; $comments = array_slice( $comments, 0, 5 ); } $comments = array_reverse( $comments ); if ( $comments ) { ?>
comment_author );?>
comment_author; ?>

comment_ID ); ?>

' . get_bloginfo( 'name' ) . ''; } else { $header = '

' . get_bloginfo( 'name' ) . '

'; } if ( get_header_image() ) { if ( display_header_text() ) { $header .= '' . esc_attr( home_url() ) . ''; } else { $header .= '' . esc_attr( home_url() ) . ''; } } return apply_filters( 'boozurk_filter_header', $header ); } } // archives pages navigation if ( !function_exists( 'boozurk_navigate_archives' ) ) { function boozurk_navigate_archives() { global $paged, $wp_query; if ( !$paged ) $paged = 1; ?> $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) ); foreach ( $attachments as $k => $attachment ) { if ( $attachment->ID == $post->ID ) break; } $nextk = $k + 1; $prevk = $k - 1; ?>
<', '><', wp_link_pages( 'before=&echo=0' ) ); ?>

'widget_search', 'WP_Widget_Meta' => 'widget_meta', 'WP_Widget_Pages' => 'widget_pages', 'WP_Widget_Links' => 'widget_links', 'WP_Widget_Categories' => 'widget_categories', 'WP_Widget_Archives' => 'widget_archive', ); foreach ( apply_filters( 'boozurk_default_widgets', $default_widgets ) as $widget => $class ) { the_widget( $widget, '', boozurk_get_default_widget_args( 'id=&class=' . $class ) ); } } } // get the post thumbnail or (if not set) the format related icon if ( !function_exists( 'boozurk_get_the_thumb' ) ) { function boozurk_get_the_thumb( $args ) { $defaults = array( 'id' => 0, 'size_w' => 32, 'size_h' => 0, 'class' => '', 'default' => '', ); $args = wp_parse_args( $args, $defaults ); if ( ! $args['size_h'] ) $args['size_h'] = $args['size_w']; if ( $args['id'] && has_post_thumbnail( $args['id'] ) ) { return get_the_post_thumbnail( $args['id'], array( $args['size_w'],$args['size_h'] ) ); } else { if ( $args['id'] ) $format = get_post_format( $args['id'] ) ? get_post_format( $args['id'] ) : 'standard'; else $format = $args['default']; return apply_filters( 'boozurk_hook_get_the_thumb', '', $format, $args ); } } } // get the post format string if ( !function_exists( 'boozurk_get_post_format' ) ) { function boozurk_get_post_format( $id ) { if ( post_password_required() ) $format = 'protected'; else $format = ( boozurk_get_opt( 'boozurk_post_formats_' . get_post_format( $id ) ) ) ? get_post_format( $id ) : '' ; return $format; } } // set up custom colors and header image if ( !function_exists( 'boozurk_setup' ) ) { function boozurk_setup() { // Register localization support load_theme_textdomain( 'boozurk', get_template_directory() . '/languages' ); // Theme uses wp_nav_menu() in three location register_nav_menus( array( 'primary' => __( 'Main Navigation Menu', 'boozurk' ) ) ); register_nav_menus( array( 'secondary1' => __( 'Secondary Navigation Menu #1', 'boozurk' ) ) ); register_nav_menus( array( 'secondary2' => __( 'Secondary Navigation Menu #2', 'boozurk' ) ) ); // Used for featured posts if a large-feature doesn't exist. set_post_thumbnail_size( 1000, 288, true ); add_image_size( 'large-feature', 1000, 288, true ); // Register Features Support add_theme_support( 'automatic-feed-links' ); // Thumbnails support add_theme_support( 'post-thumbnails' ); // Add the editor style if ( boozurk_get_opt( 'boozurk_editor_style' ) ) add_editor_style( 'css/editor-style.css' ); // This theme uses post formats $format = array(); if ( boozurk_get_opt( 'boozurk_post_formats_aside' ) ) $format[] = 'aside'; if ( boozurk_get_opt( 'boozurk_post_formats_audio' ) ) $format[] = 'audio'; if ( boozurk_get_opt( 'boozurk_post_formats_chat' ) ) $format[] = 'chat'; if ( boozurk_get_opt( 'boozurk_post_formats_gallery' ) ) $format[] = 'gallery'; if ( boozurk_get_opt( 'boozurk_post_formats_image' ) ) $format[] = 'image'; if ( boozurk_get_opt( 'boozurk_post_formats_link' ) ) $format[] = 'link'; if ( boozurk_get_opt( 'boozurk_post_formats_quote' ) ) $format[] = 'quote'; if ( boozurk_get_opt( 'boozurk_post_formats_status' ) ) $format[] = 'status'; if ( boozurk_get_opt( 'boozurk_post_formats_video' ) ) $format[] = 'video'; add_theme_support( 'post-formats', $format ); } } //add a default gravatar function boozurk_addgravatar( $avatar_defaults ) { $myavatar = get_template_directory_uri() . '/images/user.png'; $avatar_defaults[$myavatar] = __( 'boozurk Default Gravatar', 'boozurk' ); return $avatar_defaults; } // create a random nick name if ( !function_exists( 'boozurk_random_nick' ) ) { function boozurk_random_nick ( ) { $prefix = array( 'ATX-', 'Adorable ', 'Adventurous ', 'Alien ', 'Angry ', 'Annoyed ', 'Anxious ', 'Atrocious ', 'Attractive ', 'Bad ', 'Bad ', 'Barbarious ', 'Bavarian ', 'Beautiful ', 'Bewildered ', 'Bitter ', 'Black ', 'Blond ', 'Blue ', 'Blue-Eyed ', 'Bored ', 'Breezy ', 'Bright ', 'Brown ', 'Cloudy ', 'Clumsy ', 'Colorful ', 'Combative ', 'Condemned ', 'Confused ', 'Cool ', 'Crazy ', 'Creepy ', 'Cruel ', 'Cubic ', 'Curly ', 'Cute ', 'Dance ', 'Dangerous ', 'Dark ', 'Death ', 'Delicious ', 'Dinky ', 'Distinct ', 'Disturbed ', 'Dizzy ', 'Drunk ', 'Drunken ', 'Dull ', 'Dumb ', 'E-', 'Electro ', 'Elegant ', 'Elite ', 'Embarrassed ', 'Envious ', 'Evil ', 'Fancy ', 'Fast ', 'Fat ', 'Fierce ', 'Flipped-out ', 'Flying ', 'Fourios ', 'Frantic ', 'Fresh ', 'Frustraded ', 'Funny ', 'Furious ', 'Fuzzy ', 'Gameboy ', 'Giant ', 'Giga ', 'Green ', 'Handsome ', 'Hard ', 'Harsh ', 'Hazardous ', 'Hiphop ', 'Hi-res ', 'Holy ', 'Horny ', 'Hot ', 'House ', 'i-', 'Icy ', 'Infested ', 'Insane ', 'Joyous ', 'Kentucky Fried ', 'Lame ', 'Leaking ', 'Lone ', 'Lovely ', 'Lucky ', 'Mc', 'Melodic ', 'Micro ', 'Mighty ', 'Mini ', 'Mutated ', 'Nasty ', 'Nice ', 'Orange ', 'PS/2-', 'Pretty ', 'Purple ', 'Purring ', 'Quiet ', 'Radioactive ', 'Red ', 'Resonant ', 'Salty ', 'Sexy ', 'Slow ', 'Smooth ', 'Stinky ', 'Strong ', 'Supa-Dupa-', 'Super ', 'USB-', 'Ugly ', 'Unholy ', 'Vivacious ', 'Whispering ', 'White ', 'Wild ', 'X', 'XBox ', 'Yellow ' ); $suffix = array( '16', '3', '6', '7', 'Abe', 'Bee', 'Bird', 'Boy', 'Cat', 'Cow', 'Crow', 'Cypher', 'DJ', 'Dad', 'Deer', 'Dog', 'Donkey', 'Duck', 'Eagle', 'Elephant', 'Fly', 'Fox', 'Frog', 'Girl', 'Girlie', 'Guinea Pig', 'Hasi', 'Hawk', 'Jackal', 'Lizard', 'MC', 'Men', 'Mom', 'Morpheus', 'Mouse', 'Mule', 'Neo', 'Pig', 'Rabbit', 'Rat', 'Rhino', 'Smurf', 'Snail', 'Snake', 'Star', 'Tank', 'Tiger', 'Wolf', 'Butterfly', 'Elk', 'Godzilla', 'Horse', 'Penguin', 'Pony', 'Reindeer', 'Sheep', 'Sock-Puppet', 'Worm', 'Bermuda' ); return $prefix[array_rand($prefix)] . $suffix[array_rand($suffix)]; } } // Get first image of a post if ( !function_exists( 'boozurk_get_first_image' ) ) { function boozurk_get_first_image() { global $post; $first_info = array( 'img' => '', 'title' => '', 'src' => '' ); //search the images in post content preg_match_all( '/]+>/i',$post->post_content, $result ); //grab the first one if ( isset( $result[0][0] ) ){ $first_info['img'] = $result[0][0]; $first_img = $result [0][0]; //get the title (if any) preg_match_all( '/(title)=("[^"]*")/i',$first_img, $img_title ); if ( isset( $img_title[2][0] ) ){ $first_info['title'] = str_replace( '"','',$img_title[2][0] ); } //get the path preg_match_all( '/(src)=("[^"]*")/i',$first_img, $img_src ); if ( isset( $img_src[2][0] ) ){ $first_info['src'] = str_replace( '"','',$img_src[2][0] ); } return $first_info; } else { return false; } } } // Get first link of a post if ( !function_exists( 'boozurk_get_first_link' ) ) { function boozurk_get_first_link() { global $post; $first_info = array( 'anchor' => '', 'title' => '', 'href' => '', 'text' => '' ); //search the link in post content preg_match_all( "/]*>(.*?)<\/a>/i",$post->post_content, $result ); //grab the first one if ( isset( $result[0][0] ) ){ $first_info['anchor'] = $result[0][0]; $first_info['text'] = isset( $result[1][0] ) ? $result[1][0] : ''; //get the title (if any) preg_match_all( '/(title)=(["\'][^"]*["\'])/i',$first_info['anchor'], $link_title ); $first_info['title'] = isset( $link_title[2][0] ) ? str_replace( array('"','\''),'',$link_title[2][0] ) : ''; //get the path preg_match_all( '/(href)=(["\'][^"]*["\'])/i',$first_info['anchor'], $link_href ); $first_info['href'] = isset( $link_href[2][0] ) ? str_replace( array('"','\''),'',$link_href[2][0] ) : ''; return $first_info; } else { return false; } } } // Get first blockquote words if ( !function_exists( 'boozurk_get_blockquote' ) ) { function boozurk_get_blockquote() { global $post; $first_quote = array( 'quote' => '', 'cite' => '' ); //search the blockquote in post content preg_match_all( '/]*>([\w\W]*?)<\/blockquote>/',$post->post_content, $blockquote ); //grab the first one if ( isset( $blockquote[0][0] ) ){ $first_quote['quote'] = strip_tags( $blockquote[0][0] ); $words = explode( " ", $first_quote['quote'], 6 ); if ( count( $words ) == 6 ) $words[5] = '...'; $first_quote['quote'] = implode( ' ', $words ); preg_match_all( '/([\w\W]*?)<\/cite>/',$blockquote[0][0], $cite ); $first_quote['cite'] = ( isset( $cite[1][0] ) ) ? $cite[1][0] : ''; return $first_quote; } else { return false; } } } // Get first gallery if ( !function_exists( 'boozurk_get_gallery_shortcode' ) ) { function boozurk_get_gallery_shortcode() { global $post; $pattern = get_shortcode_regex(); if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches ) && array_key_exists( 2, $matches ) && in_array( 'gallery', $matches[2] ) ) // gallery shortcode is being used { $key = array_search( 'gallery', $matches[2] ); $attrs = shortcode_parse_atts( $matches['3'][$key] ); return $attrs; } } } // run the gallery preview if ( !function_exists( 'boozurk_gallery_preview' ) ) { function boozurk_gallery_preview() { $attrs = boozurk_get_gallery_shortcode(); $attrs['preview'] = true; return boozurk_gallery_shortcode( '', $attrs ); } } // the gallery preview walker if ( !function_exists( 'boozurk_gallery_preview_walker' ) ) { function boozurk_gallery_preview_walker( $attachments = '', $id = 0 ) { if ( ! $id ) return false; if ( empty( $attachments ) ) $attachments = get_children( array( 'post_parent' => $id, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) ); if ( empty( $attachments ) ) return false; $permalink = get_permalink( $id ); $images_count = count( $attachments ); $first_image = array_shift( $attachments ); $other_imgs = array_slice( $attachments, 0, 3 ); $output = '' . wp_get_attachment_image( $first_image->ID, 'medium' ) . ''; $output .= '
'; foreach ($other_imgs as $image) { $output .= ' '; } $output .= '
'; $output .= '

' . sprintf( _n( 'This gallery contains %2$s image', 'This gallery contains %2$s images', $images_count, 'boozurk' ), 'href="' . esc_url( get_permalink() ) . '" title="' . esc_attr__( 'View gallery', 'boozurk' ) . '" rel="bookmark"', number_format_i18n( $images_count ) ) . '

'; $output = apply_filters( 'boozurk_gallery_preview_walker', $output ); $output = ''; echo $output; return true; } } //add share links to post/page if ( !function_exists( 'boozurk_share_this' ) ) { function boozurk_share_this( $args = array() ){ global $post; $defaults = array( 'size' => 24, 'echo' => true, 'compact' => false, 'twitter' => 1, 'facebook' => 1, 'sina' => 1, 'tencent' => 1, 'qzone' => 1, 'reddit' => 1, 'stumbleupon' => 1, 'digg' => 1, 'orkut' => 1, 'bookmarks' => 1, 'blogger' => 1, 'delicious' => 1, 'linkedin' => 1, 'tumblr' => 1, 'mail' => 1, ); $args = wp_parse_args( $args, $defaults ); $share = array(); $pName = rawurlencode( get_the_title( $post->ID ) ); $pHref = rawurlencode( home_url() . '/?p=' . $post->ID ); $pLongHref = rawurlencode( get_permalink( $post->ID ) ); $pPict = rawurlencode( wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ) ); $pSource = rawurlencode( get_bloginfo( 'name' ) ); if ( !empty( $post->post_password ) ) $pSum = ''; elseif ( has_excerpt() ) $pSum = rawurlencode( get_the_excerpt() ); else $pSum = rawurlencode( wp_trim_words( $post->post_content, apply_filters('excerpt_length', 55), '[...]' ) ); $share['twitter'] = array( 'Twitter' , 'http://twitter.com/home?status=' . $pName . '%20-%20' . $pHref ); $share['facebook'] = array( 'Facebook' , 'http://www.facebook.com/sharer.php?u=' . $pHref. '&t=' . $pName ); $share['sina'] = array( 'Weibo' , 'http://v.t.sina.com.cn/share/share.php?url=' . $pHref ); $share['tencent'] = array( 'Tencent' , 'http://v.t.qq.com/share/share.php?url=' . $pHref . '&title=' . $pName . '&pic=' . $pPict ); $share['qzone'] = array( 'Qzone' , 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' . $pHref ); $share['reddit'] = array( 'Reddit' , 'http://reddit.com/submit?url=' . $pHref . '&title=' . $pName ); $share['stumbleupon'] = array( 'StumbleUpon' , 'http://www.stumbleupon.com/submit?url=' . $pHref . '&title=' . $pName ); $share['digg'] = array( 'Digg' , 'http://digg.com/submit?url=' . $pHref . '&title=' . $pName ); $share['orkut'] = array( 'Orkut' , 'http://promote.orkut.com/preview?nt=orkut.com&tt=' . $pName . '&du=' . $pHref . '&tn=' . $pPict ); $share['bookmarks'] = array( 'Bookmarks' , 'https://www.google.com/bookmarks/mark?op=edit&bkmk=' . $pHref . '&title=' . $pName . '&annotation=' . $pSum ); $share['blogger'] = array( 'Blogger' , 'http://www.blogger.com/blog_this.pyra?t&u=' . $pHref . '&n=' . $pName . '&pli=1' ); $share['delicious'] = array( 'Delicious' , 'http://delicious.com/post?url=' . $pHref . '&title=' . $pName . '¬es=' . $pSum ); $share['linkedin'] = array( 'LinkedIn' , 'http://www.linkedin.com/shareArticle?mini=true&url=' . $pHref . '&title=' . $pName . '&source=' . $pSource . '&summary=' . $pSum ); $share['tumblr'] = array( 'Tumblr' , 'http://www.tumblr.com/share?v=3&u=' . $pHref . '&t=' . $pName . '&s=' . $pSum ); $share['mail'] = array( 'e-mail' , 'mailto:?subject=' . rawurlencode ( __( 'Check it out!', 'boozurk' ) ) . '&body=' . $pName . '%20-%20' . $pLongHref . '%0D%0A' . $pSum ); $outer = '
'; foreach( $share as $key => $btn ){ if ( $args[$key] ) $target = ( $key != 'mail' ) ? ' target="_blank"' : ''; $outer .= ''; } $outer .= '
'; if ( $args['echo'] ) echo $outer; else return $outer; } } //Display navigation to next/previous post when applicable if ( !function_exists( 'boozurk_single_nav' ) ) { function boozurk_single_nav() { global $post; if ( ! is_single() || is_attachment() ) return; if ( ! boozurk_get_opt( 'boozurk_browse_links' ) ) return; $next = get_next_post(); $prev = get_previous_post(); $next_title = get_the_title( $next ) ? get_the_title( $next ) : __( 'Next Post', 'boozurk' ); $prev_title = get_the_title( $prev ) ? get_the_title( $prev ) : __( 'Previous Post', 'boozurk' ); ?> 1) { if ((number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1)) == 1.3 or number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1) == 1.5 or number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1) == 1.6 or number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1) == 2.5){ $imgmeta['image_meta']['shutter_speed'] = "1/" . number_format((1 / $imgmeta['image_meta']['shutter_speed']), 1, '.', ''); } else { $imgmeta['image_meta']['shutter_speed'] = "1/" . number_format((1 / $imgmeta['image_meta']['shutter_speed']), 0, '.', ''); } } $output = ''; // get other EXIF and IPTC data of digital photograph $output .= __("Width", "boozurk" ) . ": " . $imgmeta['width']."px
"; $output .= __("Height", "boozurk" ) . ": " . $imgmeta['height']."px
"; if ( $imgmeta['image_meta']['created_timestamp'] ) $output .= __("Date Taken", "boozurk" ) . ": " . date("d-M-Y H:i:s", $imgmeta['image_meta']['created_timestamp'])."
"; if ( $imgmeta['image_meta']['copyright'] ) $output .= __("Copyright", "boozurk" ) . ": " . $imgmeta['image_meta']['copyright']."
"; if ( $imgmeta['image_meta']['credit'] ) $output .= __("Credit", "boozurk" ) . ": " . $imgmeta['image_meta']['credit']."
"; if ( $imgmeta['image_meta']['title'] ) $output .= __("Title", "boozurk" ) . ": " . $imgmeta['image_meta']['title']."
"; if ( $imgmeta['image_meta']['caption'] ) $output .= __("Caption", "boozurk" ) . ": " . $imgmeta['image_meta']['caption']."
"; if ( $imgmeta['image_meta']['camera'] ) $output .= __("Camera", "boozurk" ) . ": " . $imgmeta['image_meta']['camera']."
"; if ( $imgmeta['image_meta']['focal_length'] ) $output .= __("Focal Length", "boozurk" ) . ": " . $imgmeta['image_meta']['focal_length']."mm
"; if ( $imgmeta['image_meta']['aperture'] ) $output .= __("Aperture", "boozurk" ) . ": f/" . $imgmeta['image_meta']['aperture']."
"; if ( $imgmeta['image_meta']['iso'] ) $output .= __("ISO", "boozurk" ) . ": " . $imgmeta['image_meta']['iso']."
"; if ( $imgmeta['image_meta']['shutter_speed'] ) $output .= __("Shutter Speed", "boozurk" ) . ": " . sprintf( __("%s seconds", "boozurk" ), $imgmeta['image_meta']['shutter_speed']) . "
"; $output = '
' . $output . '
'; if ( $echo ) echo $output; else return $output; } } // print extra info for posts/pages if ( !function_exists( 'boozurk_post_details' ) ) { function boozurk_post_details( $args = '' ) { global $post; $defaults = array( 'author' => 1, 'date' => 1, 'tags' => 1, 'categories' => 1, 'avatar_size' => 48, 'featured' => 0, 'echo' => 1, ); $args = wp_parse_args( $args, $defaults ); $tax_separator = apply_filters( 'boozurk_filter_taxomony_separator', ', ' ); $output = '
    '; if ( $args['featured'] && has_post_thumbnail( $post->ID ) ) $output .= '
  • ' . get_the_post_thumbnail( $post->ID, 'thumbnail') . '
  • '; if ( $args['author'] ) $output .= '
  • ' . boozurk_author_badge( $post->post_author, $args['avatar_size'] ) . '
  • '; if ( $args['categories'] ) $output .= '
  • ' . __( 'Categories', 'boozurk' ) . ': ' . get_the_category_list( $tax_separator ) . '
  • '; if ( $args['tags'] ) $tags = get_the_tags() ? get_the_tag_list( '', $tax_separator, '' ) : __( 'No Tags', 'boozurk' ) . ''; $output .= '
  • ' . __( 'Tags', 'boozurk' ) . ': ' . $tags . '
  • '; if ( $args['date'] ) $output .= '
  • ' . __( 'Published', 'boozurk' ) . ': ' . get_the_time( get_option( 'date_format' ) ) . '
  • '; $output .= '
'; if ( ! $args['echo'] ) return $output; echo $output; } } // get the author badge function boozurk_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 .= '' . esc_attr( $s_key ) . ''; } $output = '
  • ' . $avatar . '
  • '; $output .= '
  • ' . $name . '
  • '; $output .= $description ? '
  • ' . $description . '
  • ' : ''; $output .= $author_net ? '
  • ' . $author_net . '
  • ' : ''; $output = '
      ' . $output . '
    '; return apply_filters( 'boozurk_filter_author_badge', $output ); } //Displays the amount of time since a post or page was written in a nice friendly manner. //Based on Plugin: Date in a nice tone (http://wordpress.org/extend/plugins/date-in-a-nice-tone/) if ( !function_exists( 'boozurk_friendly_date' ) ) { function boozurk_friendly_date() { $postTime = get_the_time('U'); $currentTime = time(); $timeDifference = $currentTime - $postTime; $minInSecs = 60; $hourInSecs = 3600; $dayInSecs = 86400; $monthInSecs = $dayInSecs * 31; $yearInSecs = $dayInSecs * 366; //if over 2 years if ($timeDifference > ($yearInSecs * 2)) { $dateWithNiceTone = __( 'quite a long while ago...', 'boozurk' ); //if over a year } else if ($timeDifference > $yearInSecs) { $dateWithNiceTone = __( 'over a year ago', 'boozurk' ); //if over 2 months } else if ($timeDifference > ($monthInSecs * 2)) { $num = round($timeDifference / $monthInSecs); $dateWithNiceTone = sprintf(__('%s months ago', 'boozurk' ),$num); //if over a month } else if ($timeDifference > $monthInSecs) { $dateWithNiceTone = __( 'a month ago', 'boozurk' ); //if more than 2 days ago } else { $htd = human_time_diff( get_the_time('U'), current_time('timestamp') ); $dateWithNiceTone = sprintf(__('%s ago', 'boozurk' ), $htd ); } return $dateWithNiceTone; } } /** * Create HTML list of nav menu items. * Replacement for the native Walker, using the thumbnail. * * @see http://wordpress.stackexchange.com/q/14037/ * @author toscho, http://toscho.de */ class boozurk_Thumb_Walker extends Walker_Nav_Menu { /** * @see Walker::start_el() * * @param string $output Passed by reference. Used to append additional content. * @param object $item Menu item data object. * @param int $depth Depth of menu item. Used for padding. * @param int $current_page Menu item ID. * @param object $args */ function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; $class_names = $value = ''; $classes = empty( $item->classes ) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args ); $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; $output .= $indent . ''; $attributes = ! empty( $item->attr_title ) ? ' title="' . esc_attr( $item->attr_title ) .'"' : ''; $attributes .= ! empty( $item->target ) ? ' target="' . esc_attr( $item->target ) .'"' : ''; $attributes .= ! empty( $item->xfn ) ? ' rel="' . esc_attr( $item->xfn ) .'"' : ''; $attributes .= ! empty( $item->url ) ? ' href="' . esc_attr( $item->url ) .'"' : ''; $title = apply_filters( 'the_title', $item->title, $item->ID ); if ( 0 == $depth ) { $thumb = $this->get_the_thumb( $item ); if ( boozurk_get_opt( 'boozurk_main_menu' ) == 'thumbnail' ) $title = $thumb; elseif ( boozurk_get_opt( 'boozurk_main_menu' ) == 'thumbnail and text' ) $title = $thumb . $title; } $item_output = $args->before; $item_output .= ''; $item_output .= $args->link_before . $title . $args->link_after; $item_output .= ''; $item_output .= $args->after; $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } function get_the_thumb( $item ) { if ( $item->object == 'page' ) { $thumb = boozurk_get_the_thumb( array( 'id' => (int)$item->object_id, 'size_w' => (int)boozurk_get_opt( 'boozurk_main_menu_icon_size' ), 'class' => 'tb-thumb-format', ) ); } elseif ( $item->object == 'category' ) { $thumb = ''; } elseif ( $item->object == 'custom' ) { if ( $item->url ) { if ( substr( $item->url, 0, strlen(home_url())) == home_url() ) $thumb = ''; else $thumb = ''; } else { $thumb = ''; } } elseif ( $item->object == 'post_format' ) { $term = get_term($item->object_id, 'post_format' ); $thumb = ''; } else { $thumb = ''; } return $thumb; } } // retrieve the post content, then die (for "post_expander" ajax request) if ( !function_exists( 'boozurk_post_expander_show_post' ) ) { function boozurk_post_expander_show_post ( ) { if ( have_posts() ) { while ( have_posts() ) { the_post(); the_content(); } } die(); } } //is a "post_expander" ajax request? function boozurk_post_expander_activate ( ) { if ( isset( $_POST["boozurk_post_expander"] ) ) add_action( 'wp', 'boozurk_post_expander_show_post' ); } // retrieve the posts page, then die (for "infinite_scroll" ajax request) if ( !function_exists( 'boozurk_infinite_scroll_show_page' ) ) { function boozurk_infinite_scroll_show_page ( ) { global $post, $wp_query, $paged; if ( !$paged ) { $paged = 1; } if ( have_posts() ) { echo '

    ' . sprintf( __('Page %s','boozurk'), $paged ) . '

    '; while ( have_posts() ) { the_post(); ?> ID ) ); ?> '_blank' ); $wp_admin_bar->add_menu( array( 'id' => 'boozurk_theme_options', 'parent' => 'appearance', 'title' => __( 'Theme Options','boozurk' ), 'href' => get_admin_url() . 'themes.php?page=boozurk_functions', 'meta' => $add_menu_meta, ) ); } } // add the +snippet elements if ( !function_exists( 'boozurk_plus_snippet' ) ) { function boozurk_plus_snippet(){ if ( !is_singular() ) return; $_post = get_queried_object(); if ( post_password_required($_post) ) return; $content = esc_attr( wp_trim_words( strip_shortcodes( $_post->post_content ) ) ); if ($content == '') $content = __('read me!','boozurk'); ?> 1 && get_option( 'page_comments' ) ) { ?>

    '

    ' . '' . ' ' . ( $req ? '*' : '' ) .'

    ', 'email' => '', 'url' => '

    ' . '' . '' .'

    ', ); return $custom_fields; } // filters comments_form() default arguments function boozurk_comment_form_defaults( $defaults ) { $defaults['label_submit'] = __( 'Say It!','boozurk' ); $defaults['comment_field'] = '

    '; $defaults['cancel_reply_link'] = ''; return $defaults; } // add a random color to every new category function boozurk_created_category_color( $term_id, $tt_id = null, $taxonomy = null ) { global $boozurk_opt; $hexnumber = '#'; for ($i2=1; $i2<=3; $i2++) { $hexnumber .= dechex( rand(64,255) ); } $boozurk_opt['boozurk_cat_colors'][$term_id] = $hexnumber; update_option( 'boozurk_options', $boozurk_opt ); } //custom smiles function boozurk_smiles_replace( $src, $img ) { if ( boozurk_get_opt( 'boozurk_smilies' ) ) return get_template_directory_uri() . '/images/smilies/' . $img; return $src; } // add a fix for embed videos if ( !function_exists( 'boozurk_wmode_transparent' ) ) { function boozurk_wmode_transparent($html, $url = null, $attr = null) { if ( strpos( $html, ' '', 'align' => 'alignnone', 'width' => '', 'caption' => '', ), $attr)); if ( 1 > (int) $width || empty($caption) ) return $content; if ( $id ) $id = 'id="' . esc_attr($id) . '" '; return '
    ' . do_shortcode( $content ) . '
    ' . $caption . '
    '; } // convert post content in blockquote for quote format posts) function boozurk_quote_content( $content ) { /* Check if we're displaying a 'quote' post. */ if ( has_post_format( 'quote' ) && boozurk_get_opt( 'boozurk_post_formats_quote' ) ) { /* Match any
    elements. */ preg_match( '//', $content, $matches ); /* If no
    elements were found, wrap the entire content in one. */ if ( empty( $matches ) ) $content = "
    {$content}
    "; } return $content; } // Add specific CSS class by filter function boozurk_body_classes($classes) { $classes[] = 'no-js'; if ( has_nav_menu( 'secondary1' ) ) $classes[] = 'top-menu'; if ( ! is_active_widget( false, false, 'bz-navbuttons', true ) ) $classes[] = 'fixed-navigation'; if ( ! ( boozurk_get_opt( 'boozurk_sidebar_primary' ) == 'hidden' ) ) $classes[] = 'primary-sidebar'; if ( ! ( boozurk_get_opt( 'boozurk_sidebar_secondary' ) == 'hidden' ) ) $classes[] = 'secondary-sidebar'; return $classes; } // custom gallery shortcode function function boozurk_gallery_shortcode( $output, $attr ) { $post = get_post(); static $instance = 0; $instance++; if ( ! empty( $attr['ids'] ) ) { // 'ids' is explicitly ordered, unless you specify otherwise. if ( empty( $attr['orderby'] ) ) $attr['orderby'] = 'post__in'; $attr['include'] = $attr['ids']; } // We're trusting author input, so let's at least make sure it looks like a valid orderby statement if ( isset( $attr['orderby'] ) ) { $attr['orderby'] = sanitize_sql_orderby( $attr['orderby'] ); if ( !$attr['orderby'] ) unset( $attr['orderby'] ); } extract( shortcode_atts( array( 'order' => 'ASC', 'orderby' => 'menu_order ID', 'id' => $post->ID, 'itemtag' => 'dl', 'icontag' => 'dt', 'captiontag' => 'dd', 'columns' => 3, 'size' => 'thumbnail', 'include' => '', 'exclude' => '', ), $attr) ); $id = intval( $id ); if ( 'RAND' == $order ) $orderby = 'none'; if ( ! empty( $include ) ) { $_attachments = get_posts( array( 'include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); $attachments = array(); foreach ( $_attachments as $key => $val ) { $attachments[$val->ID] = $_attachments[$key]; } } elseif ( ! empty( $exclude ) ) { $attachments = get_children( array( 'post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); } else { $attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby ) ); } if ( isset( $attr['preview'] ) && $attr['preview'] ) return boozurk_gallery_preview_walker( $attachments, $id ); if ( empty($attachments) ) return ''; if ( is_feed() ) { $output = "\n"; foreach ( $attachments as $att_id => $attachment ) $output .= wp_get_attachment_link($att_id, $size, true) . "\n"; return $output; } $itemtag = tag_escape($itemtag); $captiontag = tag_escape($captiontag); $columns = intval($columns); $itemwidth = $columns > 0 ? floor(100/$columns) : 100; $selector = "gallery-{$instance}"; $size_class = sanitize_html_class( $size ); $output = "\n"; return $output; } //add attachment description to thickbox function boozurk_get_attachment_link( $markup = '', $id = 0, $size = 'thumbnail', $permalink = false, $icon = false, $text = false ) { $id = intval( $id ); $_post = get_post( $id ); if ( empty( $_post ) || ( 'attachment' != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) ) return __( 'Missing Attachment','boozurk' ); if ( $permalink ) $url = get_attachment_link( $_post->ID ); $url = esc_url( $url ); $post_title = esc_attr( $_post->post_excerpt ? $_post->post_excerpt : $_post->post_title ); if ( $text ) $link_text = $text; elseif ( $size && 'none' != $size ) $link_text = wp_get_attachment_image( $id, $size, $icon ); else $link_text = ''; if ( trim( $link_text ) == '' ) $link_text = $_post->post_title; return "$link_text"; } //print credits function boozurk_get_credits() { $credits = apply_filters( 'boozurk_credits', '© ' . date( 'Y' ) . ' ' . get_bloginfo( 'name' ) . '. ' . __( 'All rights reserved','boozurk' ) ); if ( boozurk_get_opt('boozurk_tbcred') ) $credits .= '
    ' . sprintf( __('Powered by %s and %s','boozurk'), 'WordPress', '' . esc_attr( __( 'Boozurk theme','boozurk' ) ) . ''); if ( boozurk_get_opt('boozurk_mobile_css') ) $credits .= ' - '. __('Mobile View','boozurk') .''; return $credits; } //filter wp_title function boozurk_filter_wp_title( $title ) { if ( is_single() && empty( $title ) ) { $_post = get_queried_object(); $title = boozurk_titles_filter( '', $_post->ID ) . ' « '; } // Get the Site Name $site_name = get_bloginfo( 'name' ); // Append name $filtered_title = $title . $site_name; // If site front page, append description if ( is_front_page() ) { // Get the Site Description $site_description = get_bloginfo( 'description' ); // Append Site Description to title $filtered_title .= ' - ' . $site_description; } // Return the modified title return $filtered_title; } //Add new contact methods to author panel function boozurk_new_contactmethods( $contactmethods ) { $contactmethods['twitter'] = 'Twitter'; //add Twitter $contactmethods['facebook'] = 'Facebook'; //add Facebook $contactmethods['googleplus'] = 'Google+'; //add Google+ return $contactmethods; } // add 'quoted on' before trackback/pingback comments link function boozurk_add_quoted_on( $return ) { global $comment; $text = ''; if ( get_comment_type() != 'comment' ) $text = '' . __( 'quoted on', 'boozurk' ) . ' '; return $text . $return; } // strip tags and apply title format for blank titles function boozurk_titles_filter( $title, $id = null ) { if ( is_admin() ) return $title; $title = strip_tags( $title, '' ); if ( $id == null ) return $title; if ( ! boozurk_get_opt( 'boozurk_blank_title' ) ) return $title; if ( empty( $title ) ) { if ( ! boozurk_get_opt( 'boozurk_blank_title_text' ) ) return __( '(no title)', 'boozurk' ); $postdata = array( get_post_format( $id )? get_post_format_string( get_post_format( $id ) ): __( 'Post', 'boozurk' ), get_the_time( get_option( 'date_format' ), $id ), $id ); $codes = array( '%f', '%d', '%n' ); return str_replace( $codes, $postdata, boozurk_get_opt( 'boozurk_blank_title_text' ) ); } else return $title; } //set the excerpt length function boozurk_excerpt_length( $length ) { return (int) boozurk_get_opt( 'boozurk_excerpt_length' ); } // use the "excerpt more" string as a link to the post function boozurk_excerpt_more( $more ) { if ( is_admin() ) return $more; if ( boozurk_get_opt( 'boozurk_excerpt_more_txt' ) ) $more = boozurk_get_opt( 'boozurk_excerpt_more_txt' ); if ( boozurk_get_opt( 'boozurk_excerpt_more_link' ) ) $more = '' . $more . ''; return $more; } // custom text for the "more" tag function boozurk_more_link( $more_link, $more_link_text ) { if ( boozurk_get_opt( 'boozurk_more_tag' ) && !is_admin() ) { $text = str_replace ( '%t', get_the_title(), boozurk_get_opt( 'boozurk_more_tag' ) ); return str_replace( $more_link_text, $text, $more_link ); } return $more_link; } /** * Add parent class to wp_page_menu top parent list items */ function boozurk_add_parent_class( $css_class, $page, $depth, $args ) { if ( ! empty( $args['has_children'] ) && $depth == 0 ) $css_class[] = 'menu-item-parent'; return $css_class; } /** * Add parent class to wp_nav_menu top parent list items */ function boozurk_add_menu_parent_class( $items ) { $parents = array(); foreach ( $items as $item ) { if ( $item->menu_item_parent && $item->menu_item_parent > 0 ) { $parents[] = $item->menu_item_parent; } } foreach ( $items as $item ) { if ( in_array( $item->ID, $parents ) ) { if ( ! $item->menu_item_parent ) $item->classes[] = 'menu-item-parent'; } } return $items; } /** * Add 'selected' class to current page item in menus */ function boozurk_add_selected_class_to_page_item( $css_class ) { if ( in_array( 'current_page_item', $css_class ) ) $css_class[] = 'selected'; return $css_class; } /** * Add 'selected' class to current menu item in menus */ function boozurk_add_selected_class_to_menu_item( $classes, $item ) { if ( $item->current ) $classes[] = 'selected'; return $classes; } // wrap the categories count with a span function boozurk_wrap_categories_count( $output ) { $pattern = '/<\/a>\s(\(\d+\))/i'; $replacement = ' $1'; return preg_replace( $pattern, $replacement, $output ); } // show all categories list (redirect to allcat.php if allcat=y) if ( !function_exists( 'boozurk_allcat' ) ) { function boozurk_allcat () { if( boozurk_is_allcat() ) { get_template_part( 'allcat' ); exit; } } } //replace the comment_reply_link text function boozurk_comment_reply_link( $link ) { preg_match_all( '/]*>(.*?)<\/a>/',$link, $text ); if ( isset( $text[1][0] ) ) $link = str_replace( '>' . $text[1][0], ' title="' . esc_attr__( 'Reply to comment', 'boozurk' ) . '" >', $link); return $link; } //replace the edit_comment_link text function boozurk_edit_comment_link( $link ) { preg_match_all( '/]*>(.*?)<\/a>/',$link, $text ); if ( isset( $text[1][0] ) ) $link = str_replace( $text[1][0], '', $link); return $link; } // display the second secondary menu function boozurk_primary_menu() { wp_nav_menu( array( 'container' => false, 'menu_id' => 'mainmenu', 'menu_class' => 'nav-menu', 'fallback_cb' => 'boozurk_pages_menu', 'theme_location' => 'primary', 'walker' => new boozurk_Thumb_Walker, ) ); } // display the first secondary menu function boozurk_1st_secondary_menu() { wp_nav_menu( array( 'container' => false, 'menu_id' => 'secondary1', 'menu_class' => 'nav-menu', 'fallback_cb' => false, 'theme_location' => 'secondary1', 'depth' => 1, ) ); } // display the second secondary menu function boozurk_2nd_secondary_menu() { wp_nav_menu( array( 'container' => false, 'menu_id' => 'secondary2', 'menu_class' => 'nav-menu', 'fallback_cb' => false, 'theme_location' => 'secondary2', 'depth' => 1, ) ); } //add "Home" link function boozurk_add_home_link( $items = '', $args = null ) { if ( ! $items ) return $items; $defaults = array( 'theme_location' => 'undefined', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', ); $args = wp_parse_args( $args, $defaults ); if ( ( $args['theme_location'] === 'primary' ) && ( 'posts' == get_option( 'show_on_front' ) ) ) { if ( is_front_page() || is_single() ) $class = ' selected'; else $class = ''; $homeMenuItem = ''; $items = $homeMenuItem . $items; } return $items; } // Pages Menu if ( !function_exists( 'boozurk_pages_menu' ) ) { function boozurk_pages_menu() { $menu = boozurk_add_home_link( $items = wp_list_pages( 'sort_column=menu_order&title_li=&echo=0' ), $args = 'theme_location=primary' ); if ( ! $menu ) return; echo ''; } } // display the logo and site description function boozurk_secondary_sidebar_top() { if ( boozurk_get_opt( 'boozurk_logo' ) ) echo ''; if ( boozurk_get_opt( 'boozurk_logo_description' ) ) echo '
    ' . get_bloginfo( 'description' ) . '
    '; } // display the header widget area function boozurk_header_widget_area() { get_sidebar( 'header' ); }