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 ''; } // 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 ) { ?>
comment_author );?>
comment_author; ?>

comment_ID ); ?>

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 = '

' . 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; ?> '', '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['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 = '
    '; 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' => '

    ' . '' . ' ' . ( $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 . '
    '; } // Add specific CSS class by filter function boozurk_body_classes( $classes ) { $classes[] = 'no-js'; $classes[] = 'theme_version_' . str_replace( ".", '', boozurk_get_info( 'version' ) ); 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; } // Add specific CSS class by filter function boozurk_post_classes( $classes ) { $classes[] = 'post-element'; return $classes; } //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' ) ); $more_link = str_replace( $more_link_text, $text, $more_link ); } if ( boozurk_get_opt( 'boozurk_more_tag_scroll' ) ) $more_link = preg_replace( '|#more-[0-9]+|', '', $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 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' => 'div', 'container_id' => 'secondary1_wrap', '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; } // Display search form. function boozurk_search_form() { $form = ' '; return $form; } // 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' ); } function boozurk_fixed_header() { if ( boozurk_get_opt( 'boozurk_fixed_header' ) ) { switch ( current_filter() ) { case 'boozurk_hook_header_before': echo '
    '; break; case 'boozurk_hook_header_after': echo '
    '; break; } } }