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' ) ),
'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 '
';
if ( boozurk_get_opt( 'boozurk_post_date' ) )
echo '- ' . get_the_time( get_option( 'date_format' ) ) . '
';
if ( boozurk_get_opt( 'boozurk_post_cat' ) && $categories = get_the_category() ) {
echo '- ';
the_category(', ');
echo '
';
}
if ( boozurk_get_opt( 'boozurk_post_tag' ) && $the_tag_list = get_the_tag_list( '', ', ', '' ) ) {
echo '- ' . $the_tag_list . '
';
}
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 );
if ( boozurk_get_opt( 'boozurk_hide_frontpage_title' ) && is_page() && is_front_page() ) return;
if ( boozurk_get_opt( 'boozurk_hide_pages_title' ) && is_page() ) return;
if ( boozurk_get_opt( 'boozurk_hide_posts_title' ) && is_single() ) return;
if ( $selected_ids = boozurk_get_opt( 'boozurk_hide_selected_entries_title' ) ) {
$selected_ids = explode( ',', $selected_ids );
if ( in_array( $post->ID, $selected_ids ) ) return;
}
$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' );
}
}
$post_title = apply_filters( 'boozurk_featured_title_text', $post_title );
$thumb = apply_filters( 'boozurk_featured_title_thumb', $thumb );
// 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,
'share' => 1,
);
$args = wp_parse_args( $args, $defaults );
$args = apply_filters( 'boozurk_extrainfo', $args );
$share_type = boozurk_get_opt( 'boozurk_plusone' );
?>
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 ) {
?>
1,
'comment' => 1,
'feed' => 1,
'trackback' => 1,
'home' => 1,
'next_prev' => 1,
'up_down' => 1,
'fixed' => 1,
);
$args = wp_parse_args( $args, $defaults );
$args = apply_filters( 'boozurk_navbuttons', $args );
extract( $args );
$is_post = is_single() && ! is_attachment() && ! boozurk_is_allcat();
$is_image = is_attachment() && ! boozurk_is_allcat();
$is_page = is_singular() && ! is_single() && ! is_attachment() && ! boozurk_is_allcat();
$is_singular = is_singular() && ! boozurk_is_allcat();
?>
' . get_bloginfo( 'name' ) . '';
} else {
$header = '';
}
if ( get_header_image() ) {
if ( display_header_text() ) {
$header .= '
';
} else {
$header .= '
';
}
}
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;
?>
' ); ?>
' . __( 'page %1$s of %2$s','boozurk' ) . '', $paged, $wp_query->max_num_pages ); ?>
' ); ?>
$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;
?>
'' . '' . __( 'Pages','boozurk' ) . ':',
'after' => '
',
'link_before' => '',
'link_after' => '',
'echo' => 0,
);
?>
<', '><', wp_link_pages( $args ) ); ?>
' . $link . '';
return $link;
}
// the widget area for single posts/pages
function boozurk_single_widgets_area() {
if ( !is_singular() ) return;
if ( apply_filters( 'boozurk_skip_post_widgets_area', false ) ) return;
if ( is_active_sidebar( 'single-widgets-area' ) ) {
?>
'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 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
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 = '' . $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 .= '
';
}
$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' );
}
// 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' ) ) {
?>
__( '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' => '',
'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, '