/**** begin theme checks ****/ // check if in preview mode or not $shiword_is_printpreview = false; if ( isset( $_GET['style'] ) && md5( $_GET['style'] ) == '8e77921d24c6f82c4bd783895e9d9cf1' ) { //print preview $shiword_is_printpreview = true; } // check if is "all category" page $shiword_is_allcat_page = false; if ( isset( $_GET['allcat'] ) && ( md5( $_GET['allcat'] ) == '415290769594460e2e485922904f345d' ) ) { $shiword_is_allcat_page = true; } /**** end theme checks ****/ // Set the content width based on the theme's design if ( ! isset( $content_width ) ) { if ( ! $shiword_is_mobile_browser ) { $content_width = $shiword_opt['shiword_frame_width'] - 290; } else { $content_width = 300; } } // get theme version if ( get_theme( 'Shiword' ) ) { $shiword_current_theme = get_theme( 'Shiword' ); $shiword_version = $shiword_current_theme['Version']; } if ( !function_exists( 'shiword_widgets_init' ) ) { function shiword_widgets_init() { global $shiword_opt; // Area 1, located at the top of the sidebar. if ( !isset( $shiword_opt['shiword_rsideb'] ) || $shiword_opt['shiword_rsideb'] == 1 ) { register_sidebar( array( 'name' => __( 'Sidebar Widget Area', 'shiword' ), 'id' => 'primary-widget-area', 'description' => '', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); }; // Area 2, located in the header. Empty by default. register_sidebar( array( 'name' => __( 'Header Widget Area', 'shiword' ), 'id' => 'header-widget-area', 'description' => __( 'Tips: Don't drag too much widgets here. Use small "graphical" widgets (eg icons, buttons, the search form, etc.)', 'shiword' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); // Area 3, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'Footer Widget Area #1', 'shiword' ), 'id' => 'first-footer-widget-area', 'description' => '', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); // Area 4, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'Footer Widget Area #2', 'shiword' ), 'id' => 'second-footer-widget-area', 'description' => '', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); // Area 5, located in the footer. Empty by default. register_sidebar( array( 'name' => __( 'Footer Widget Area #3', 'shiword' ), 'id' => 'third-footer-widget-area', 'description' => '', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); // Area 6, located just after post/page content. Empty by default. register_sidebar( array( 'name' => __( 'Single Widget Area', 'shiword' ), 'id' => 'single-widget-area', 'description' => __( 'Located after the post/page content, it is the ideal place for your widgets related to individual entries', 'shiword' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); // Area 7, located in page 404. register_sidebar( array( 'name' => __( 'Page 404', 'shiword' ), 'id' => '404-widgets-area', 'description' => __( 'Enrich the page 404 with some useful widgets', 'shiword' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '
', 'after_title' => '
', ) ); } } // skip every sidebar if in print preview if ( !function_exists( 'shiword_get_sidebar' ) ) { function shiword_get_sidebar( $name = '' ) { global $shiword_is_printpreview; if ( $shiword_is_printpreview ) return; get_sidebar( $name ); } } // Add stylesheets to page if ( !function_exists( 'shiword_stylesheet' ) ) { function shiword_stylesheet(){ global $shiword_version, $shiword_is_printpreview, $shiword_is_mobile_browser, $shiword_opt; if ( is_admin() ) return; if ( $shiword_is_mobile_browser ) return; //shows print preview / normal view if ( $shiword_is_printpreview ) { //print preview wp_enqueue_style( 'sw-print-style-preview', get_template_directory_uri() . '/css/print.css', false, $shiword_version, 'screen' ); wp_enqueue_style( 'sw-general-style-preview', get_template_directory_uri() . '/css/print_preview.css', false, $shiword_version, 'screen' ); } else { //normal view //thickbox style if ( ( $shiword_opt['shiword_thickbox'] == 1 ) ) wp_enqueue_style( 'thickbox' ); wp_enqueue_style( 'sw-general-style', get_stylesheet_uri(), false, $shiword_version, 'screen' ); } //google font if ( $shiword_opt['shiword_google_font_family'] ) wp_enqueue_style( 'sw-google-fonts', 'http://fonts.googleapis.com/css?family=' . str_replace( ' ', '+' , $shiword_opt['shiword_google_font_family'] ) ); //print style wp_enqueue_style( 'sw-print-style', get_template_directory_uri() . '/css/print.css', false, $shiword_version, 'print' ); } } if ( !function_exists( 'shiword_ie6_style' ) ) { function shiword_ie6_style() { ?> '; } } if ( !function_exists( 'shiword_navlinks' ) ) { function shiword_navlinks( $position = 'top' ) { global $shiword_opt, $shiword_is_printpreview; if ( !$shiword_opt['shiword_navlinks'] || $shiword_is_printpreview ) return; $sep = ( get_next_post() && get_previous_post() ) ? ' - ' : ''; ?> 'page', 'post_parent' => $post->ID, 'order' => 'ASC', 'orderby' => 'menu_order', 'numberposts' => 0 ); $childrens = get_posts( $args ); // retrieve the child pages $the_parent_page = $post->post_parent; // retrieve the parent page $has_herarchy = false; if ( ( $childrens ) || ( $the_parent_page ) ){ // add the hierarchy metafield ?>
' . get_the_title( $the_parent_page ) . ''; echo __( 'Parent page', 'shiword' ) . ': ' . $the_parent_link ; // echoes the parent } if ( ( $childrens ) && ( $the_parent_page ) ) { echo ' - '; } // if parent & child, echoes the separator if ( $childrens ) { $the_child_list = ''; foreach ( $childrens as $children ) { $the_child_list[] = '' . get_the_title( $children ) . ''; } $the_child_list = implode( ', ' , $the_child_list ); echo __( 'Child pages', 'shiword' ) . ': ' . $the_child_list; // echoes the childs } ?>
1, 'date' => 1, 'comms' => 1, 'tags' => 1, 'cats' => 1, 'hiera' => 1, 'in_index' => 1 ); $args = wp_parse_args( $args, $defaults ); //xinfos disabled when... if ( ! $shiword_opt['shiword_xinfos_global'] ) return; //xinfos globally disabled if ( is_front_page() && ( get_option( 'show_on_front' ) == 'page') ) return; // is front page if ( ! is_singular() && isset( $shiword_opt['shiword_xinfos'] ) && ! $shiword_opt['shiword_xinfos'] ) return; // !'in posts index' + is index if ( ! is_singular() && ! $args['in_index'] ) return; // !'in_index' + is index $r_pos = 10; // animated xinfos if ( $shiword_opt['shiword_xinfos_static'] == 0 ) { ?>
' . get_the_author() . '' : $args['auth']; ?>
' . get_the_time( get_option( 'date_format' ) ) . '' ); ?>
' . get_the_author() . '' ); echo '
'; }; ?> '; }?> '; } ?> '; } ?> '; } ?>
' . wp_title( '',false ) . ''); } elseif ( is_search() ) { $type = sprintf( __( 'Search results for “%s”', 'shiword' ), '' . esc_html( get_search_query() ) . '' ); } if ( $type ) { ?>

0, 'tags' => 0, 'categories' => 0 ) ); } } // add a fix for embed videos if ( !function_exists( 'shiword_wmode_transparent' ) ) { function shiword_wmode_transparent($html, $url, $attr) { if ( strpos( $html, ' '', '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( 'shiword_get_first_link' ) ) { function shiword_get_first_link() { global $post, $posts; $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( 'shiword_get_blockquote' ) ) { function shiword_get_blockquote() { global $post, $posts; $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; } } } // search for linked mp3's and add an audio player if ( !function_exists( 'shiword_add_audio_player' ) ) { function shiword_add_audio_player( $text = '' ) { global $post; $pattern = "/([^<]+)<\/a>/i"; if ( $text == '') preg_match_all( $pattern, $post->post_content, $result ); else preg_match_all( $pattern, $text, $result ); $data = $result[3]; if ( $data ) { ?> $class ) ); } else { if ( shiword_is_post_format_available( $id ) ) { $format = get_post_format( $id ); } else { $format = 'thumb'; } $output = 'thumb'; } if ( $linked ) return '' . $output . ''; else return $output; } } // display the post title with the featured image if ( !function_exists( 'shiword_post_title' ) ) { function shiword_post_title( $args = '' ) { global $post, $shiword_opt; $defaults = array( 'alternative' => '', 'fallback' => '', 'featured' => 0, 'href' => get_permalink(), 'target' => '', 'title' => the_title_attribute( array('echo' => 0 ) ), 'extra' => '' ); $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'].'"' : ''; $has_format = shiword_is_post_format_available( $post->ID ); $has_featured_image = $args['featured'] && ( $shiword_opt['shiword_supadupa_title'] == 1 ) && has_post_thumbnail( $post->ID ) && ( $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( 700, 700 ) ) ) && ( $image[1] >= 700 ) && ( $image[2] >= 200 ); $title_class = ( $has_format && !$has_featured_image ) ? ' sw-icon-' . get_post_format( $post->ID ) : '' ; if ( $post_title ) $post_title = '

' . $args['extra'] . '' . $post_title . '

'; if ( $has_featured_image ) { ?>
1, 'date' => 1, 'tags' => 1, 'categories' => 1, 'avatar_size' => 48, 'featured' => 0 ); $args = wp_parse_args( $args, $defaults ); ?> ID ) ) { echo '
' . get_the_post_thumbnail( $post->ID, 'thumbnail' ) . '
'; } ?> post_author; $name = get_the_author_meta( 'nickname', $author ); $alt_name = get_the_author_meta( 'user_nicename', $author ); $avatar = get_avatar( $author, $args['avatar_size'], 'Gravatar Logo', $alt_name.'-photo' ); $description = get_the_author_meta( 'description', $author ); $author_link = get_author_posts_url( $author ); ?>

twitter'; ?> facebook'; ?>

'; } ?> '; } ?> __( 'Main Navigation Menu', 'shiword' ), 'secondary' => __( 'Secondary Navigation Menu
only supports the first level of hierarchy', 'shiword' ) ) ); // This theme allows users to set the device appearance shiword_add_custom_device_image(); // Your changeable header business starts here define( 'HEADER_TEXTCOLOR', '404040' ); // No CSS, just IMG call. The %s is a placeholder for the theme template directory URI. define( 'HEADER_IMAGE', '%s/images/headers/green.jpg' ); // The height and width of your custom header. You can hook into the theme's own filters to change these values. // Add a filter to shiword_header_image_width and shiword_header_image_height to change these values. define( 'HEADER_IMAGE_WIDTH', $shiword_opt['shiword_frame_width'] ); $head_h = ( isset( $shiword_opt['shiword_head_h'] ) ? str_replace( 'px', '', $shiword_opt['shiword_head_h']) : 100 ); define( 'HEADER_IMAGE_HEIGHT', $head_h ); // Don't support text inside the header image. define( 'NO_HEADER_TEXT', true ); // Add a way for the custom header to be styled in the admin panel that controls // custom headers. See shiword_admin_header_style(), below. add_custom_image_header( 'shiword_header_style', 'shiword_admin_header_style' ); /* * Note: as of WordPress 3.4, add_custom_image_header() is * deprecated, in favor of * add_theme_support( 'custom-header' ). Child Themes * can remove support for this feature via * remove_theme_support( 'custom-header' ). */ /* add_theme_support( 'custom-header', array( // Header image default 'default-image' => get_template_directory_uri() . '/images/headers/green.jpg', // Header text display default 'header-text' => false, // Header text color default 'default-text-color' => '404040', // Header image width (in pixels) 'width' => $shiword_opt['shiword_frame_width'], // Header image height (in pixels) 'height' => $head_h, // Header image random rotation default 'random-default' => false, // Template header style callback 'wp-head-callback' => 'shiword_header_style', // Admin header style callback 'admin-head-callback' => 'shiword_admin_header_style' ) ); */ // Add a way for the custom background to be styled in the admin panel that controls if ( isset( $shiword_opt['shiword_custom_bg'] ) && $shiword_opt['shiword_custom_bg'] == 1 ) { shiword_add_custom_background( 'shiword_custom_bg_plus' , '' , '' ); } else { set_theme_mod('background_image', ''); set_theme_mod('background_image_thumb', ''); add_custom_background( 'shiword_custom_bg' , '' , '' ); /* * Note: as of WordPress 3.4, add_custom_background() is * deprecated, in favor of * add_theme_support( 'custom-background' ). Child Themes * can remove support for this feature via * remove_theme_support( 'custom-background' ). */ /* $defaults = array( 'default-color' => '', 'default-image' => '', 'wp-head-callback' => 'shiword_custom_bg', 'admin-head-callback' => '', 'admin-preview-callback' => '' ); add_theme_support( 'custom-background', $defaults ); */ } // ... and thus ends the changeable header business. // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI. register_default_headers( array( 'green' => array( 'url' => '%s/images/headers/green.jpg', 'thumbnail_url' => '%s/images/headers/green_thumbnail.jpg', 'description' => 'green' ), 'black' => array( 'url' => '%s/images/headers/black.jpg', 'thumbnail_url' => '%s/images/headers/black_thumbnail.jpg', 'description' => 'black' ), 'brown' => array( 'url' => '%s/images/headers/brown.jpg', 'thumbnail_url' => '%s/images/headers/brown_thumbnail.jpg', 'description' => 'brown' ), 'blue' => array( 'url' => '%s/images/headers/blue.jpg', 'thumbnail_url' => '%s/images/headers/blue_thumbnail.jpg', 'description' => 'blue' ), 'butterflies' => array( 'url' => '%s/images/headers/butterflies.gif', 'thumbnail_url' => '%s/images/headers/butterflies_thumbnail.jpg', 'description' => 'butterflies' ) ) ); shiword_register_default_device_images( array( 'green' => array( 'url' => '%s/images/device/white.png', 'description' => 'white' ), 'black' => array( 'url' => '%s/images/device/black.png', 'description' => 'black' ), 'pink' => array( 'url' => '%s/images/device/pink.png', 'description' => 'pink' ), 'blue' => array( 'url' => '%s/images/device/blue.png', 'description' => 'blue' ), 'vector' => array( 'url' => '%s/images/device/vector.png', 'description' => 'vector' ), 'ice' => array( 'url' => '%s/images/device/ice.png', 'description' => 'ice' ), 'metal' => array( 'url' => '%s/images/device/metal.png', 'description' => 'metal' ), 'stripe' => array( 'url' => '%s/images/device/stripe.png', 'description' => 'stripe' ), 'flower' => array( 'url' => '%s/images/device/flower.png', 'description' => 'flower' ), 'wood' => array( 'url' => '%s/images/device/wood.jpg', 'description' => 'wood' ) ) ); } } // convert hex color value to rgba if ( !function_exists( 'shiword_hex2rgba' ) ) { function shiword_hex2rgba($hex,$alpha) { $color = str_replace('#','',$hex); if ( $color == 'transparent' ) { return 'transparent'; } else { $rgba = 'rgba(' . hexdec(substr($color,0,2)) . ',' . hexdec(substr($color,2,2)) . ',' . hexdec(substr($color,4,2)) . ',' . round(intval($alpha) / 100, 3) . ')'; return $rgba; } } } // get lightness of from rgb color if ( !function_exists( 'shiword_rgblight' ) ) { function shiword_rgblight($hex) { $color = str_replace('#','',$hex); $rgba['r'] = hexdec(substr($color,0,2)); $rgba['g'] = hexdec(substr($color,2,2)); $rgba['b'] = hexdec(substr($color,4,2)); $var_min = min( $rgba['r'], $rgba['g'], $rgba['b'] ); //min. value of rgb $var_max = max( $rgba['r'], $rgba['g'], $rgba['b'] ); //max. value of rgb $lightness = ( $var_max + $var_min ) / 2; return $lightness; } } // custom header image style - gets included in the site header if ( !function_exists( 'shiword_header_style' ) ) { function shiword_header_style() { global $shiword_colors, $shiword_is_mobile_browser, $shiword_opt; if ( $shiword_is_mobile_browser ) return; $device_rgba = shiword_hex2rgba( $shiword_colors['device_color'], $shiword_colors['device_opacity']); ?> '; } } // add links to admin bar if ( !function_exists( 'shiword_admin_bar_plus' ) ) { function shiword_admin_bar_plus() { global $wp_admin_bar, $shiword_opt; if ( !current_user_can( 'edit_theme_options' ) || !is_admin_bar_showing() ) return; $add_menu_meta = array( 'target' => '_blank' ); // slideshow if ( $shiword_opt['shiword_sticky'] == 1 ) { $wp_admin_bar->add_menu(array( 'id' => 'sw_slideshow', 'parent' => 'appearance', 'title' => __('Slideshow','shiword'), 'href' => get_admin_url() . 'themes.php?page=tb_shiword_slideshow', 'meta' => $add_menu_meta )); } $wp_admin_bar->add_menu(array( 'id' => 'sw_theme_options', 'parent' => 'appearance', 'title' => __('Theme Options','shiword'), 'href' => get_admin_url() . 'themes.php?page=tb_shiword_functions', 'meta' => $add_menu_meta )); } } // add 'quoted on' before trackback/pingback comments link if ( !function_exists( 'shiword_add_quoted_on' ) ) { function shiword_add_quoted_on( $return ) { global $comment; $text = ''; if ( get_comment_type() != 'comment' ) { $text = '' . __( 'quoted on', 'shiword' ) . ' '; } return $text . $return; } } // the real comment count if ( !function_exists( 'shiword_comment_count' ) ) { function shiword_comment_count( $count ) { if ( ! is_admin() ) { global $id; $comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id)); return count($comments_by_type['comment']); } else { return $count; } } } // check if the current post has a format and if it's available if ( !function_exists( 'shiword_is_post_format_available' ) ) { function shiword_is_post_format_available( $id ) { global $shiword_opt; $is_available = function_exists( 'get_post_format' ) && get_post_format( $id ) && isset( $shiword_opt['shiword_postformat_' . get_post_format( $id ) ] ) && $shiword_opt['shiword_postformat_' . get_post_format( $id ) ] == 1; return $is_available; } } //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( 'shiword_friendly_date' ) ) { function shiword_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...', 'shiword' ); //if over a year } else if ($timedifference > $yearinsecs) { $datewithnicetone = __( 'over a year ago', 'shiword' ); //if over 2 months } else if ($timedifference > ($monthinsecs * 2)) { $num = round($timedifference / $monthinsecs); $datewithnicetone = sprintf(__('%s months ago', 'shiword' ),$num); //if over a month } else if ($timedifference > $monthinsecs) { $datewithnicetone = __( 'a month ago', 'shiword' ); //if more than 2 days ago } else { $htd = human_time_diff( get_the_time('U'), current_time('timestamp') ); $datewithnicetone = sprintf(__('%s ago', 'shiword' ), $htd ); } echo $datewithnicetone; } } // custom image caption if ( !function_exists( 'shiword_img_caption_shortcode' ) ) { function shiword_img_caption_shortcode( $deprecated, $attr, $content = null) { extract(shortcode_atts(array( 'id' => '', '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 . '
'; } } // custom gallery shortcode function function shiword_gallery_shortcode($attr) { global $post, $wp_locale, $shiword_opt; static $instance = 0; $instance++; // Allow plugins/themes to override the default gallery template. $output = apply_filters('post_gallery', '', $attr); if ( $output != '' ) return $output; // 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)); if ( $shiword_opt['shiword_thickbox_link_to_image'] == 1 ) $attr['link'] = 'file'; $id = intval($id); if ( 'RAND' == $order ) $orderby = 'none'; if ( !empty($include) ) { $include = preg_replace( '/[^0-9,]+/', '', $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]; } if ( ( $orderby == 'none' ) && ( $order != 'RAND' ) && !is_feed() ) { unset( $_attachments ); $_include = split( ',', $include ); foreach ( $_include as $key => $val ) { if ( isset( $attachments[$val] ) ) $_attachments[] = $attachments[$val]; } $attachments = $_attachments; } } elseif ( !empty($exclude) ) { $exclude = preg_replace( '/[^0-9,]+/', '', $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 ( 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); $float = is_rtl() ? 'right' : 'left'; $selector = "gallery-{$instance}"; $size_class = sanitize_html_class( $size ); $gallery_div = "\n"; return $output; } // strip tags from titles and apply title format for blank ones function shiword_title_tags_filter($title,$id) { global $shiword_opt; if ( is_admin() ) return $title; $title = strip_tags( $title, '' ); if ( empty( $title ) ) { if ( !isset( $shiword_opt['shiword_blank_title'] ) || empty( $shiword_opt['shiword_blank_title'] ) ) return __( '(no title)', 'shiword' ); $postdata = array( get_post_format( $id )? __(get_post_format( $id ), 'shiword'): __('post', 'shiword'), get_the_time( get_option( 'date_format' ), $id ) ); $codes = array( '%f', '%d' ); return str_replace( $codes, $postdata, $shiword_opt['shiword_blank_title'] ); } else return $title; } // overwrite the lang settings for the front-side function shiword_theme_localized($locale) { global $shiword_opt; if ( isset( $shiword_opt['shiword_lang_code'] ) && !is_admin() ) { return $shiword_opt['shiword_lang_code']; } return $locale; } // use the "excerpt more" string as a link to the post function shiword_new_excerpt_more( $more ) { global $shiword_opt, $post; if ( is_admin() ) return $more; if ( isset( $shiword_opt['shiword_xcont_more_txt'] ) && isset( $shiword_opt['shiword_xcont_more_link'] ) ) { if ( $shiword_opt['shiword_xcont_more_link'] ) { return '' . $shiword_opt['shiword_xcont_more_txt'] . ''; } else { return $shiword_opt['shiword_xcont_more_txt']; } } return $more; } // custom text for the "more" tag function shiword_more_link( $more_link, $more_link_text ) { global $shiword_opt; if ( isset( $shiword_opt['shiword_more_tag'] ) && !is_admin() ) { $text = str_replace ( '%t', get_the_title(), $shiword_opt['shiword_more_tag'] ); return str_replace( $more_link_text, $text, $more_link ); } return $more_link; } // the search form function shiword_search_form( $form ) { global $shiword_is_mobile_browser; if ( ! $shiword_is_mobile_browser ) $form = '
'; return $form; } // display a simple login form in quickbar if ( !function_exists( 'shiword_mini_login' ) ) { function shiword_mini_login() { global $shiword_opt; $args = array( 'redirect' => home_url(), 'form_id' => 'sw-loginform', 'id_username' => 'sw-user_login', 'id_password' => 'sw-user_pass', 'id_remember' => 'sw-rememberme', 'id_submit' => 'sw-submit' ); ?>
  • $length ) { $ret_string = substr( $string, $start, $length ) . $wrap; } else { $ret_string = $string; } return $ret_string; } } ?>