' . "\n"; // Check if logo available, then display it. if ($logo_id) : echo '' . "\n"; // If not, then display the Site Title else : echo '

' . "\n"; endif; // display Site Description echo '

' . esc_attr(get_bloginfo('description')) . '

'; // closing wrapper echo '' . "\n"; } endif; if (!function_exists('avish_social_icons')) : /** * Header social */ function avish_social_icons($position = 'header') { // Get the customizer data $tw = avish_mod(PREFIX . 'twitter'); $fb = avish_mod(PREFIX . 'facebook'); $gplus = avish_mod(PREFIX . 'gplus'); $instagram = avish_mod(PREFIX . 'instagram'); $pinterest = avish_mod(PREFIX . 'pinterest'); $linkedin = avish_mod(PREFIX . 'linkedin'); $tumblr = avish_mod(PREFIX . 'tumblr'); $rss = avish_mod(PREFIX . 'rss'); // Display the data if ($tw || $fb || $gplus || $instagram || $pinterest || $tumblr || $rss) { echo '
'; if ($tw) { echo ' '; } if ($fb) { echo ' '; } if ($gplus) { echo ' '; } if ($instagram) { echo ' '; } if ($pinterest) { echo ' '; } if ($linkedin) { echo ' '; } if ($tumblr) { echo ' '; } if ($rss) { echo ''; } echo '
'; } } endif; if (!function_exists('avish_posted_on')) : /** * Prints HTML with meta information for the current post-date/time and author. * * @since 1.0.0 */ function avish_posted_on() { // Get the date style (from Single Posts) $date_style = avish_mod(PREFIX . 'post-date-style'); ?> 'ids', 'hide_empty' => 1, // We only need to know if there is more than one category. 'number' => 2, )); // Count the number of categories that are attached to the posts. $all_the_cool_cats = count($all_the_cool_cats); set_transient('avish_categories', $all_the_cool_cats); } if ($all_the_cool_cats > 1) { // This blog has more than 1 category so avish_categorized_blog should return true. return true; } else { // This blog has only 1 category so avish_categorized_blog should return false. return false; } } /** * Flush out the transients used in avish_categorized_blog. * * @since 1.0.0 */ function avish_category_transient_flusher() { if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } // Like, beat it. Dig? delete_transient('avish_categories'); } add_action('edit_category', 'avish_category_transient_flusher'); add_action('save_post', 'avish_category_transient_flusher'); if (!function_exists('avish_entry_share')) : /** * Social share. * * @since 1.0.0 */ function avish_entry_share() { // Get the data set in customizer $share = avish_mod(PREFIX . 'post-share'); if (!$share) { return; } ?> > %2$s', esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_html(get_the_author()) ); ?>
>

'ids')); // Bail if the term empty. if (empty($terms)) { return; } // Posts query arguments. $query = array( 'post__not_in' => array(get_the_ID()), 'tax_query' => array( array( 'taxonomy' => 'category', 'field' => 'id', 'terms' => $terms, 'operator' => 'IN' ) ), 'posts_per_page' => 1, 'post_type' => 'post', ); // Allow dev to filter the query. $args = apply_filters('avish_related_posts_args', $query); // The post query $related = new WP_Query($args); if ($related->have_posts()) : ?>

comment_type) : case 'pingback' : case 'trackback' : // Display trackbacks differently than normal comments. ?>
  • id="comment-" >

    > > ', ''); ?>

  • id="li-comment-" >
    > %4$s', esc_url(get_comment_link($comment->comment_ID)), get_comment_time('c'), /* translators: 1: date, 2: time */ sprintf(__('%1$s at %2$s', 'avish'), get_comment_date(), get_comment_time()), sprintf(__('%1$s· Edit%2$s', 'avish'), '', '') ); ?>
    > comment_approved) : ?>

    __('Reply', 'avish'), 'depth' => $depth, 'max_depth' => $args['max_depth']))); ?>
    ' . __('Author', 'avish') . ''; } // Display the badge return apply_filters('avish_comment_author_badge', $output); } endif; if (!function_exists('avish_comment_count')) : /** * Comment count * * @since 1.0.0 */ function avish_comment_count() { // Get the default value. $enable = avish_mod(PREFIX . 'post-comment'); if ($enable) : if (!post_password_required() && (comments_open() || '0' != get_comments_number())) : ?> not working * http://www.wprecipes.com/how-to-get-the-first-image-from-the-post-and-display-it * * @return string An HTML img tag for the first image in a post content. */ function avish_get_first_image($size = 'full', $echo = true) { // TO-DO: handle when $echo is false if (has_post_thumbnail() && $echo) { return avish_featured_image($size); } // Expose information about the current post. global $post; // We'll trap to see if this stays empty later in the function. $src = ''; // Grab all img src's in the post content // $output = preg_match_all( '//i', $post->post_content, $matches ); // not working $output = preg_match_all('//i', $post->post_content, $matches); // Grab the first img src returned by our regex. // if ( ! isset ( $matches[1][0] ) ) { return false; } // $src = $matches[1][0]; // Grab the first complete markup returned by our regex. if (!isset ($matches[0][0])) { return false; } $src = $matches[0][0]; // Make sure there's still something worth outputting after sanitization. if (empty($src)) { return false; } // add wrapper $content = '
    '; $content .= ''; $content .= $src; $content .= ''; $content .= '
    '; // choose whether to echo the result or return it as variable if (true == $echo) echo $content; else return $src; } endif; if (!function_exists('avish_get_format_gallery')) : /** * Get the [gallery] shortcode from the post content and display it on index page. It require * gallery ids [gallery ids=1,2,3,4] to display it as thumbnail slideshow. If no ids exist it * just display it as avish [gallery] markup. * * If no [gallery] shortcode found in the post content, get the attached images to the post and * display it as slideshow. * * @since 1.0.0 * @uses get_post_gallery() to get the gallery in the post content. * @uses wp_get_attachment_image() to get the HTML image. * @uses get_children() to get the attached images if no [gallery] found in the post content. * @return string */ function avish_get_format_gallery() { // Set up placeholders $slider = ''; $carousel = ''; $size = 'large'; // Check the [gallery] shortcode in post content. $gallery = get_post_gallery(get_the_ID(), false); // Check if the [gallery] exist. if ($gallery) { // Check if the gallery ids exist. if (isset($gallery['ids'])) { // Get the gallery ids and convert it into array. $ids = explode(',', $gallery['ids']); // Display the gallery in a cool slideshow on index page. foreach ($ids as $id) { $slider .= '
  • '; $slider .= wp_get_attachment_image($id, $size, false, array('class' => 'entry-thumbnail')); $slider .= '
  • '; } } else { // If gallery ids not exist, display the avish gallery markup. // avoid this, since it'll look bad // $html = get_post_gallery( get_the_ID() ); // if gallery based on images attached to post (only [gallery] in post content) // note: in the post content, better to use: [gallery size="large"] or [gallery size="full"] $srcs = $gallery['src']; // Display the gallery in a cool slideshow on index page. foreach ($srcs as $src) { $slider .= '
  • '; $slider .= ''; $slider .= '
  • '; } } // If no [gallery] in post content, get attached images to the post. } else { // Set up default arguments. $defaults = array( 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => get_the_ID(), 'post_mime_type' => 'image', 'numberposts' => -1 ); // Retrieves attachments from the post. $attachments = get_children(apply_filters('avish_gallery_format_args', $defaults)); // Check if attachments exist. if ($attachments) { // Display the attachment images in a cool slideshow on index page. foreach ($attachments as $attachment) { $slider .= '
  • '; $slider .= wp_get_attachment_image($attachment->ID, $size, false, array('class' => 'entry-thumbnail')); $slider .= '
  • '; } } else { // if no [gallery] shortcode and has no attachments, bail them out return; } } ?>
    ' tag. */ $content_url = preg_match('/]*?href=[\'"](.+?)[\'"]/is', make_clickable($post->post_content), $matches); $content_url = !empty($matches[1]) ? esc_url_raw($matches[1]) : ''; $url = !empty($content_url) ? $content_url : get_permalink(get_the_ID()); } if ($url) { ?>

    ' . stripslashes($footer_text) . ''; } endif; if (!function_exists('avish_header_style')) : /** * Header class for header style */ function avish_header_style() { // Get the customizer data $header_style = avish_mod(PREFIX . 'header-style'); // Print the header class if ($header_style) echo esc_attr($header_style); } endif; if (!function_exists('avish_posts_layout')) : /** * Custom archive page layout classes. * * @since 1.0.0 */ function avish_posts_layout() { // Get the default layout. if (is_category()) { $layout = avish_mod(PREFIX . 'cat-layout'); } elseif (is_tag()) { $layout = avish_mod(PREFIX . 'tag-layout'); } elseif (is_author()) { $layout = avish_mod(PREFIX . 'author-layout'); } elseif (is_search()) { $layout = avish_mod(PREFIX . 'search-layout'); } else { $layout = avish_mod(PREFIX . 'archive-layout'); } // Set up empty variable. $class = ''; if ('blog' === $layout) { $class = 'loop-blog'; } elseif ('list' === $layout) { $class = 'loop-list'; } elseif ('grid' === $layout) { $class = 'loop-grid'; } // Allow dev to filter the class. echo esc_attr(apply_filters('avish_archive_page_classes', $class)); } endif; if (!function_exists('avish_featured_image')) : /** * Featured Image * * @since 1.0.0 */ function avish_featured_image($size = 'large') { // always true for Archive $enable = true; // Get the data set in customizer if (is_single()) { $enable = avish_mod(PREFIX . 'post-thumbnail'); } if ($enable && has_post_thumbnail()) : ?>
    'entry-thumbnail', 'alt' => esc_attr(get_the_title()))); ?>
    > name); ?> > 'post', 'posts_per_page' => absint($num), 'orderby' => $orderby, 'ignore_sticky_posts' => 1 ); // Limit to tag based on user selected tag. if (!empty($tag)) { $args['tag_id'] = $tag; } // Allow dev to filter the post arguments. $args = apply_filters('avish_featured_slider_args', $args); // The post query. $slider = new WP_Query($args); if ($slider->have_posts()) : ?>

    > / > / > / >