'primary', 'container' => false, 'menu_class' => 'sf-menu', 'menu_id' => 'menu', 'fallback_cb' => 'th_wp_page_menu')); } function th_wp_page_menu() { echo ''; } // post content image thumbnail function th_post_image($width, $height) { $w = $width; $h = $height; global $post; //This is required to set to Null $img_source = ''; $permalink = get_permalink($post->ID); $output = preg_match_all('//i', $post->post_content, $matches); if (isset($matches [1] [0])) { $img_source = $matches [1] [0]; } if($img_source!=''){ $img_path = th_image_resize($img_source, $w, $h); if (!empty($img_path['url'])) { print "Post Image"; } } } /* * Blog page pagination * */ function th_pagination($pages = '', $range =2) { $showitems = ($range * 2) + 1; global $paged; if (empty($paged)) $paged = 1; if ($pages == '') { global $wp_query; $pages = $wp_query->max_num_pages; if (!$pages) { $pages = 1; } } if (1 != $pages) { echo "\n"; } } /** * Display navigation to next/previous post when applicable. * * @since ThemeHunk 1.0 */ if ( ! function_exists( 'th_post_nav' ) ) : function th_post_nav() { // Don't print empty markup if there's nowhere to navigate. $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); $next = get_adjacent_post( false, '', false ); if ( ! $next && ! $previous ) { return; } ?> '; // tag before the current crumb $after = ''; // tag after the current crumb /* === END OF OPTIONS === */ global $post; $home_link = home_url('/'); $link_before = ''; $link_after = ''; $link_attr = ' rel="v:url" property="v:title"'; $link = $link_before . '%2$s' . $link_after; $parent_id = $parent_id_2 = $post->post_parent; $frontpage_id = get_option('page_on_front'); if (is_home() || is_front_page()) { if ($show_on_home == 1) echo ''; } else { /* xmlns:v="http://rdf.data-vocabulary.org/#"*/ echo ''; } } /** * The Gallery shortcode. * * This implements the functionality of the Gallery Shortcode for displaying * WordPress images on a post. * * @param array $attr Attributes of the shortcode. * @return string HTML content to display gallery. */ //remove_shortcode('gallery'); //add_shortcode('gallery', 'th_gallery_shortcode'); function t1h_gallery_shortcode($attr) { $post = get_post(); static $instance = 0; $instance++; if (!empty($attr['ids'])) { // 'ids' is explicitly ordered, unless you specify otherwise. if (empty($attr['orderby'])) $attr['orderby'] = 'post__in'; $attr['include'] = $attr['ids']; } // 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)); $id = intval($id); if ('RAND' == $order) $orderby = 'none'; if (!empty($include)) { $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); $attachments = array(); foreach ($_attachments as $key => $val) { $attachments[$val->ID] = $_attachments[$key]; } } elseif (!empty($exclude)) { $attachments = get_children(array('post_parent' => $id, 'exclude' => $exclude, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } else { $attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } if (empty($attachments)) return ''; if (is_feed()) { $output = "\n"; foreach ($attachments as $att_id => $attachment) $output .= wp_get_attachment_link($att_id, $size, true) . "\n"; return $output; } $itemtag = tag_escape($itemtag); $captiontag = tag_escape($captiontag); $columns = intval($columns); $itemwidth = $columns > 0 ? floor(100 / $columns) : 100; $float = is_rtl() ? 'right' : 'left'; $selector = "gallery-{$instance}"; ?> #{$selector} { margin: auto; } #{$selector} .gallery-item { float: {$float}; margin-top: 10px; text-align: center; width: {$itemwidth}%; } #{$selector} img { } #{$selector} .gallery-caption { margin-left: 0; } "; $size_class = sanitize_html_class($size); $gallery_div = "" ; return $output; } /** * custom post excerpt * */ function get_th_custom_excerpt(){ $excerpt = get_the_content(); $excerpt = preg_replace(" (\[.*?\])",'',$excerpt); $excerpt = strip_shortcodes($excerpt); $excerpt = strip_tags($excerpt); $excerpt = substr($excerpt, 0, 100); $excerpt = substr($excerpt, 0, strripos($excerpt, " ")); $excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt)); return $excerpt; } ?>