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' ) ), 'cooltips_selector' => esc_js( implode( ',', apply_filters( 'boozurk_cooltips_selector', array( '#quotethis', '#cancel-comment-reply-link', '.comment-reply-link', '.pmb_comm', '.minibutton', '.share-item img', '.tb_categories a', '#bz-quotethis', '.tb_latest_commentators li', '.tb_social a', '.post-format-item.compact img', 'a.bz-tipped-anchor', ) ) ) ), ); wp_localize_script( 'boozurk-script', 'boozurk_l10n', $data ); } } // post-top date, tags and categories function boozurk_print_details() { if ( is_singular() ) return; echo '
]*>([\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 .= ''; 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 cancel_comment_reply_link text function boozurk_cancel_comment_reply_link( $link ) { $link = str_replace( 'id="cancel-comment-reply-link"', 'id="cancel-comment-reply-link" title="' . esc_attr__( 'Cancel reply', '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 = ''; foreach ($other_imgs as $image) { $output .= ''; $output .= '' . wp_get_attachment_image( $image->ID, 'thumbnail' ) . ''; } $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 = '' . $output . ''; echo $output; return true; } } //add share links to post/page if ( !function_exists( 'boozurk_share_this' ) ) { function boozurk_share_this( $args = array() ){ $defaults = array( 'size' => 24, 'echo' => true, 'compact' => false, 'split' => 0, 'id' => 0, 'title' => false, 'href' => false, 'href_short' => false, 'thumb' => false, 'source' => false, 'summary' => false, 'twitter' => 1, 'facebook' => 1, 'googleplus' => 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 ); $post = get_post( $args['id'] ); $enc_title = $args['title'] ? $args['title'] : rawurlencode( get_the_title( $post->ID ) ); $enc_href = $args['href'] ? $args['href'] : rawurlencode( get_permalink( $post->ID ) ); $enc_href_short = $args['href_short'] ? $args['href_short'] : rawurlencode( home_url() . '/?p=' . $post->ID ); $enc_thumb = $args['thumb'] ? $args['thumb'] : rawurlencode( boozurk_get_the_thumb_url( $post->ID ) ); $enc_source = $args['source'] ? $args['source'] : rawurlencode( get_bloginfo( 'name' ) ); if ( $args['summary'] ) $enc_summary = $args['summary']; elseif ( !empty( $post->post_password ) ) $enc_summary = ''; elseif ( has_excerpt() ) $enc_summary = rawurlencode( get_the_excerpt() ); else $enc_summary = rawurlencode( wp_trim_words( $post->post_content, apply_filters('excerpt_length', 55), '[...]' ) ); $share['twitter'] = array( 'Twitter', 'http://twitter.com/home?status=' . $enc_title . '%20-%20' . $enc_href_short ); $share['facebook'] = array( 'Facebook', 'http://www.facebook.com/sharer.php?u=' . $enc_href_short. '&t=' . $enc_title ); $share['googleplus'] = array( 'Google+', 'https://plus.google.com/share?url=' . $enc_href_short ); $share['sina'] = array( 'Weibo', 'http://v.t.sina.com.cn/share/share.php?url=' . $enc_href_short ); $share['tencent'] = array( 'Tencent', 'http://v.t.qq.com/share/share.php?url=' . $enc_href_short . '&title=' . $enc_title . '&pic=' . $enc_thumb ); $share['qzone'] = array( 'Qzone', 'http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' . $enc_href_short ); $share['reddit'] = array( 'Reddit', 'http://reddit.com/submit?url=' . $enc_href_short . '&title=' . $enc_title ); $share['stumbleupon'] = array( 'StumbleUpon', 'http://www.stumbleupon.com/submit?url=' . $enc_href_short . '&title=' . $enc_title ); $share['digg'] = array( 'Digg', 'http://digg.com/submit?url=' . $enc_href_short . '&title=' . $enc_title ); $share['orkut'] = array( 'Orkut', 'http://promote.orkut.com/preview?nt=orkut.com&tt=' . $enc_title . '&du=' . $enc_href_short . '&tn=' . $enc_thumb ); $share['bookmarks'] = array( 'Bookmarks', 'https://www.google.com/bookmarks/mark?op=edit&bkmk=' . $enc_href_short . '&title=' . $enc_title . '&annotation=' . $enc_summary ); $share['blogger'] = array( 'Blogger', 'http://www.blogger.com/blog_this.pyra?t&u=' . $enc_href_short . '&n=' . $enc_title . '&pli=1' ); $share['delicious'] = array( 'Delicious', 'http://delicious.com/post?url=' . $enc_href_short . '&title=' . $enc_title . '¬es=' . $enc_summary ); $share['linkedin'] = array( 'LinkedIn', 'http://www.linkedin.com/shareArticle?mini=true&url=' . $enc_href_short . '&title=' . $enc_title . '&source=' . $enc_source . '&summary=' . $enc_summary ); $share['tumblr'] = array( 'Tumblr', 'http://www.tumblr.com/share?v=3&u=' . $enc_href_short . '&t=' . $enc_title . '&s=' . $enc_summary ); $share['mail'] = array( 'e-mail', 'mailto:?subject=' . rawurlencode ( __( 'Check it out!', 'fastfood' ) ) . '&body=' . $enc_title . '%20-%20' . $enc_href . '%0D%0A' . $enc_summary ); $share = apply_filters( 'boozurk_filter_share_this', $share ); $outer = ''; foreach( $share as $key => $btn ){ if ( $args[$key] ) $target = ( $key != 'mail' ) ? ' target="_blank"' : ''; $outer .= ''; if ( $args['echo'] ) echo $outer; else return $outer; } } //get a thumb for a post/page if ( !function_exists( 'boozurk_get_the_thumb_url' ) ) { function boozurk_get_the_thumb_url( $post_id = 0 ){ global $post; if ( !$post_id ) $post_id = $post->ID; // has featured image if ( get_post_thumbnail_id( $post_id ) ) return wp_get_attachment_thumb_url( get_post_thumbnail_id( $post_id ) ); $attachments = get_children( array( 'post_parent' => $post_id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 1, ) ); //has attachments if ( $attachments ) return wp_get_attachment_thumb_url( key($attachments) ); //has an hardcoded'; } $outer .= '
if ( $img = boozurk_get_first_image() ) return $img['src']; //has a generated
if ( $img = boozurk_get_first_image( false, true) ) return $img['src']; if ( $img = get_header_image() ) return $img; //nothing found return ''; } } //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 = ''; 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 .= '
'; 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 .= '- ' . 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 .= ''; if ( $args['date'] ) $output .= '- ' . __( 'Published', 'boozurk' ) . ': ' . get_the_time( get_option( 'date_format' ) ) . '
'; $output .= ''; } $output = '
' . $avatar . ' '; $output .= '' . $name . ' '; $output .= $description ? '' . $description . ' ' : ''; $output .= $author_net ? '' . $author_net . ' ' : ''; $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 ' '; 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' ) ) { ?>' . sprintf( __('Page %s','boozurk'), $paged ) . '
__( 'No Comments', 'boozurk' ), 'one' => __( '1 Comment', 'boozurk' ), 'more' => __( '% Comments', 'boozurk' ), 'none' => __( 'Comments are closed', 'boozurk' ), 'id' => get_the_ID(), 'class' => '', 'echo' => 1, ); $args = wp_parse_args( $args, $defaults ); $number = get_comments_number( $args['id'] ); $css_class = ( ! empty( $args['class'] ) ) ? ' class="' . esc_attr( $args['class'] ) . '"' : ''; if ( 0 == $number && !comments_open( $args['id'] ) ) { $output = '' . $args['none'] . ''; } elseif ( post_password_required( $args['id'] ) ) { $output = ''; } else { if ( 0 == $number ) $href = get_permalink( $args['id'] ) . '#respond'; else $href = get_comments_link( $args['id'] ); $title = ' title="' . esc_attr( sprintf( __( 'Comments on %s', 'boozurk' ), strip_tags( get_the_title( $args['id'] ) ) ) ) . '"'; if ( $number > 1 ) $text = str_replace( '%', number_format_i18n( $number ), $args['more'] ); elseif ( $number == 0 ) $text = $args['zero']; else // must be one $text = $args['one']; $text = apply_filters( 'comments_number', $text, $number ); $output = '' . $text . ''; } $output = apply_filters( 'boozurk_comments_link', $output ); if ( $args['echo'] ) echo $output; else return $output; } //enqueue the 'comment-reply' script function boozurk_enqueue_comments_reply() { if( get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); } // Custom form fields for the comment form function boozurk_comments_form_fields( $fields ) { $commenter = wp_get_current_commenter(); $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); $custom_fields = array( 'author' => '', 'email' => '' . '' . ' ' . ( $req ? '*' : '' ) .'
', '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, '