' . "\n"; echo '' . "\n"; echo '' . "\n"; // If not, then display the Site Title and Site Description. else : echo ''. "\n"; endif; } endif; if ( ! function_exists( 'beginner_social_icons' ) ) : /** * Header social */ function beginner_social_icons( $position = 'header' ) { // Get the customizer data $tw = beginner_mod( PREFIX . 'twitter' ); $fb = beginner_mod( PREFIX . 'facebook' ); $gplus = beginner_mod( PREFIX . 'gplus' ); $instagram = beginner_mod( PREFIX . 'instagram' ); $pinterest = beginner_mod( PREFIX . 'pinterest' ); $linkedin = beginner_mod( PREFIX . 'linkedin' ); $tumblr = beginner_mod( PREFIX . 'tumblr' ); $rss = beginner_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( 'beginner_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. * * @since 1.0.0 */ function beginner_posted_on() { // bail out if not 'Post' if ( 'post' != get_post_type() && 'deal' != get_post_type() ) return; // Get the data set in customizer $author = beginner_mod( PREFIX . 'post-author' ); $cat = beginner_mod( PREFIX . 'post-cat' ); $date = beginner_mod( PREFIX . 'post-date' ); $category = get_the_category( get_the_ID() ); ?>
/> %1$s %2$s ', '' . get_avatar( is_email( get_the_author_meta( 'user_email' ) ), 32, '', strip_tags( get_the_author() ) ) . '', _x( 'By:', 'post meta', 'beginner' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_html( get_the_author() ) ); // separator if ( $author && ( $cat || $date ) ) echo '|'; // category if ( $cat && $category ) printf( _x( '%1$sIn: %2$s%3$s', 'post meta', 'beginner' ), '', '' . esc_attr( $category[0]->name ) . '', '' ); // separator if ( ( $cat && $category ) && $date ) echo '|'; // post date if ( $date ) { // Get the date style $date_type = beginner_mod( PREFIX . 'post-date-type' ); $date_style = beginner_mod( PREFIX . 'post-date-style' ); if ( 'published' == $date_type ) { $datestamp = get_the_date(); $timestamp = get_the_time( 'U' ); $datetime = get_the_date( 'c' ); } else { $datestamp = get_the_modified_date(); $timestamp = get_the_modified_time( 'U' ); $datetime = get_the_modified_date( 'c' ); } if ( 'absolute' == $date_style ) { $date_string = esc_html( $datestamp ); } else { $date_string = sprintf( __( '%s ago', 'beginner' ), human_time_diff( $timestamp, current_time( 'timestamp' ) ) ); } $time_string = sprintf( '', esc_attr( $datetime ), $date_string ); printf( _x( 'Last Updated: %1$s', 'post meta', 'beginner' ), $time_string ); } ?>
'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( 'beginner_categories', $all_the_cool_cats ); } if ( $all_the_cool_cats > 1 ) { // This blog has more than 1 category so beginner_categorized_blog should return true. return true; } else { // This blog has only 1 category so beginner_categorized_blog should return false. return false; } } endif; if ( ! function_exists( 'beginner_category_transient_flusher' ) ) : /** * Flush out the transients used in beginner_categorized_blog. * * @since 1.0.0 */ function beginner_category_transient_flusher() { if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { return; } // Like, beat it. Dig? delete_transient( 'beginner_categories' ); } endif; add_action( 'edit_category', 'beginner_category_transient_flusher' ); add_action( 'save_post', 'beginner_category_transient_flusher' ); if ( ! function_exists( 'beginner_entry_share' ) ) : /** * Social share. * * @since 1.0.0 */ function beginner_entry_share() { // Get the data set in customizer $share = beginner_mod( PREFIX . 'post-share' ); if ( $share == 0 ) { return; } ?>
>

'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' => 3, 'post_type' => 'post', ); // Allow dev to filter the query. $args = apply_filters( 'beginner_related_posts_args', $query ); // The post query $related = new WP_Query( $args ); if ( $related->have_posts() ) : $i = 1; ?>

have_posts() ) : $related->the_post(); ?>
comment_type ) : case 'pingback' : case 'trackback' : // Display trackbacks differently than normal comments. ?>
  • id="comment-" >

    > > ', '' ); ?>

  • id="li-comment-" >
    > ', '' ); printf( ' %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', 'beginner' ), get_comment_date(), get_comment_time() ), $edit_comment_link ); ?>
    > comment_approved ) : ?>

    __( 'Reply', 'beginner' ), 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    ' . __( 'Author', 'beginner' ) . ''; } // Display the badge return apply_filters( 'beginner_comment_author_badge', $output ); } endif; if ( ! function_exists( 'beginner_get_first_image' ) ) : /** * Return an HTML img tag for the first image in a post content. Used to draw * the content for posts of the “image” format. * http://css-tricks.com/snippets/wordpress/get-the-first-image-from-a-post/#comment-1582091 --> 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 beginner_get_first_image( $size = 'full', $echo = true ) { // TO-DO: handle when $echo is false if ( has_post_thumbnail() && $echo ) { return beginner_featured_image( array( 'size' => $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( 'beginner_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 beginner [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 beginner_get_format_gallery() { // Set up a default, empty $html variable. $html = ''; // for has_sidebar $size = 'medium_large'; // for no sidebar if ( current_theme_supports( 'theme-layouts' ) && ! is_admin() ) { if ( 'layout-1c' == theme_layouts_get_layout() ) { $size = 'large'; } } // Check the [gallery] shortcode in post content. $gallery = get_post_gallery( get_the_ID(), false ); // opening wrapper $html = '
    '; // 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 ) { $html .= '
    '; $html .= wp_get_attachment_image( $id, $size, false, array( 'class' => 'entry-thumbnail' ) ); $html .= '
    '; } } else { // If gallery ids not exist, display the beginner 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 ) { $html .= '
    '; $html .= ''; $html .= '
    '; } } // 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( 'beginner_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 ) { $html .= '
    '; $html .= wp_get_attachment_image( $attachment->ID, $size, false, array( 'class' => 'entry-thumbnail' ) ); $html .= '
    '; } } else { // if no [gallery] shortcode and has no attachments, bail them out return; } } // closing wrapper $html .= '
    '; // Return the gallery images. return $html; } endif; if ( ! function_exists( 'beginner_get_post_format_link_url' ) ) : /** * Forked from hybrid_get_the_post_format_url. * Filters 'get_the_post_format_url' to make for a more robust and back-compatible function. If WP did * not find a URL, check the post content for one. If nothing is found, return the post permalink. * Used in Post Format Link * * @since 1.0.0 */ function beginner_get_post_format_link_url( $url = '', $post = null ) { if ( empty( $url ) ) { $post = is_null( $post ) ? get_post() : $post; /* Catch links that are not wrapped in an '' 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( 'beginner_featured_image' ) ) : /** * Featured Image * $args = array( $size, $default, $link, $share ) * * @since 1.0.0 */ function beginner_featured_image( $args ) { $size = 'medium_large'; // for no sidebar if ( current_theme_supports( 'theme-layouts' ) && ! is_admin() ) { if ( 'layout-1c' == theme_layouts_get_layout() ) { $size = 'large'; } } $defaults = array( 'size' => $size, 'default' => false, 'link' => true ); $args = wp_parse_args( $args, $defaults ); extract( $args ); if ( $default || has_post_thumbnail() ) : ?>
    'entry-thumbnail', 'alt' => esc_attr( get_the_title() ) ) ); ?> <?php echo esc_attr( get_the_title() ); ?>
    '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' => 'deal_category', 'field' => 'id', 'terms' => $terms, 'operator' => 'IN' ) ), 'posts_per_page' => 3, 'post_type' => 'deal', ); // Allow dev to filter the query. $args = apply_filters( 'beginner_related_deals_args', $query ); // The post query $related = new WP_Query( $args ); if ( $related->have_posts() ) : ?>

    have_posts() ) : $related->the_post(); ?> current_post + 1 ) % 3 ) ? 'hentry grid last' : 'hentry grid'; ?>
    term_id ) ) $current_term = $current->term_id; ?>