__( 'Primary Menu', 'surfarama' ), ) ); add_theme_support('post-thumbnails'); // This theme styles the visual editor with editor-style.css to match the theme style. add_editor_style(); // custom backgrounds $surfarama_custom_background = array( // Background color default 'default-color' => 'ffffff', // Background image default 'default-image' => '', 'wp-head-callback' => '_custom_background_cb' ); add_theme_support('custom-background', $surfarama_custom_background ); // adding post format support add_theme_support( 'post-formats', array( 'aside', /* Typically styled without a title. Similar to a Facebook note update */ 'gallery', /* A gallery of images. Post will likely contain a gallery shortcode and will have image attachments */ 'link', /* A link to another site. Themes may wish to use the first tag in the post content as the external link for that post. An alternative approach could be if the post consists only of a URL, then that will be the URL and the title (post_title) will be the name attached to the anchor for it */ 'image', /* A single image. The first tag in the post could be considered the image. Alternatively, if the post consists only of a URL, that will be the image URL and the title of the post (post_title) will be the title attribute for the image */ 'quote', /* A quotation. Probably will contain a blockquote holding the quote content. Alternatively, the quote may be just the content, with the source/author being the title */ 'status', /*A short status update, similar to a Twitter status update */ 'video', /* A single video. The first
  • id="li-comment-">
    $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    query( array( 'number' => $no_comments ) ); $comm = ''; if ( $comments ) : foreach ( $comments as $comment ) : $comm .= '
  • '; $comm .= ''; $comm .= get_comment_author( $comment->comment_ID ) . ': '; $comm .= strip_tags( substr( apply_filters( 'get_comment_text', $comment->comment_content ), 0, $comment_len ) ) . '
  • '; endforeach; else : $comm .= 'No comments.'; endif; echo $comm; } endif; if ( ! function_exists( 'surfarama_posted_on' ) ) : /** * Prints HTML with meta information for the current post-date/time and author. */ function surfarama_posted_on() { printf( __( 'Author Date ', 'surfarama' ), esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'surfarama' ), get_the_author() ) ), esc_html( get_the_author() ) ); } endif; /** * Adds custom classes to the array of body classes. */ if ( ! function_exists( 'surfarama_body_classes' ) ) : function surfarama_body_classes( $classes ) { // Adds a class of single-author to blogs with only 1 published author if ( ! is_multi_author() ) { $classes[] = 'single-author'; } return $classes; } endif; add_filter( 'body_class', 'surfarama_body_classes' ); /** * Returns true if a blog has more than 1 category */ if ( ! function_exists( 'surfarama_categorized_blog' ) ) : function surfarama_categorized_blog() { if ( false === ( $all_the_cool_cats = get_transient( 'all_the_cool_cats' ) ) ) { // Create an array of all the categories that are attached to posts $all_the_cool_cats = get_categories( array( 'hide_empty' => 1, ) ); // Count the number of categories that are attached to the posts $all_the_cool_cats = count( $all_the_cool_cats ); set_transient( 'all_the_cool_cats', $all_the_cool_cats ); } if ( '1' != $all_the_cool_cats ) { // This blog has more than 1 category so surfarama_categorized_blog should return true return true; } else { // This blog has only 1 category so surfarama_categorized_blog should return false return false; } } endif; /** * Flush out the transients used in surfarama_categorized_blog */ if ( ! function_exists( 'surfarama_category_transient_flusher' ) ) : function surfarama_category_transient_flusher() { // Like, beat it. Dig? delete_transient( 'all_the_cool_cats' ); } endif; add_action( 'edit_category', 'surfarama_category_transient_flusher' ); add_action( 'save_post', 'surfarama_category_transient_flusher' ); /** * Remove WP default gallery styling */ add_filter( 'use_default_gallery_style', '__return_false' ); /** * Filter in a link to a content ID attribute for the next/previous image links on image attachment pages */ if ( ! function_exists( 'surfarama_enhanced_image_navigation' ) ) : function surfarama_enhanced_image_navigation( $url ) { global $post, $wp_rewrite; $id = (int) $post->ID; $object = get_post( $id ); if ( wp_attachment_is_image( $post->ID ) && ( $wp_rewrite->using_permalinks() && ( $object->post_parent > 0 ) && ( $object->post_parent != $id ) ) ) $url = $url . '#main'; return $url; } endif; add_filter( 'attachment_link', 'surfarama_enhanced_image_navigation' ); /** * Adds color picker meta field to categories */ if ( ! function_exists( 'surfarama_cat_add_color' ) ) : function surfarama_cat_add_color() { // this will add the custom meta field to the add new term page ?>

    term_id; // retrieve the existing value(s) for this meta field. This returns an array $term_meta = get_option( "taxonomy_$t_id" ); ?>

    max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages) { printf( __( '\n"; } } endif; if ( ! function_exists( 'surfarama_excerpt' ) ) : function surfarama_excerpt($limit) { $excerpt = explode(' ', get_the_excerpt(), $limit); if (count($excerpt)>=$limit) { array_pop($excerpt); $excerpt = implode(" ",$excerpt).'...'; } else { $excerpt = implode(" ",$excerpt); } $excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt); return $excerpt; } endif; if ( ! function_exists( 'surfarama_w3c_valid_rel' ) ) : function surfarama_w3c_valid_rel( $text ) { $text = str_replace('rel="category tag"', 'rel="tag"', $text); return $text; } endif; add_filter( 'the_category', 'surfarama_w3c_valid_rel' ); if ( ! function_exists( 'surfarama_modernizr_addclass' ) ) : function surfarama_modernizr_addclass($output) { return $output . ' class="no-js"'; } endif; add_filter('language_attributes', 'surfarama_modernizr_addclass'); if ( ! function_exists( 'surfarama_modernizr_script' ) ) : function surfarama_modernizr_script() { wp_enqueue_script( 'modernizr', get_template_directory_uri() . '/library/js/modernizr-2.6.2.min.js', false, '2.6.2'); } endif; add_action('wp_enqueue_scripts', 'surfarama_modernizr_script'); if ( ! function_exists( 'surfarama_custom_scripts' ) ) : function surfarama_custom_scripts() { wp_register_script( 'imagesloaded', get_template_directory_uri() . '/library/js/imagesloaded.pkgd.min.js'); wp_register_script( 'masonry', get_template_directory_uri() . '/library/js/masonry.pkgd.min.js'); wp_enqueue_script( 'surfarama_custom_js', get_template_directory_uri() . '/library/js/scripts.js', array( 'jquery', 'masonry', 'imagesloaded' ), '1.0.0' ); wp_enqueue_style( 'surfarama_style', get_stylesheet_uri() ); } endif; add_action('wp_enqueue_scripts', 'surfarama_custom_scripts'); if ( ! function_exists( 'surfarama_enqueue_color_picker' ) ) : function surfarama_enqueue_color_picker( $hook_suffix ) { // first check that $hook_suffix is appropriate for your admin page wp_enqueue_style( 'wp-color-picker' ); wp_enqueue_script( 'surfarama-color-picker', get_template_directory_uri() . '/library/js/scripts-admin.js', array( 'wp-color-picker' ), false, true ); } endif; add_action( 'admin_enqueue_scripts', 'surfarama_enqueue_color_picker' ); /** * Get Embed Video for post format video */ if ( ! function_exists('surfarama_featured_video') ) : function surfarama_featured_video( &$content ) { $url = trim( array_shift( explode( "\n", $content ) ) ); $w = get_option( 'embed_size_w' ); if ( !is_single() ) $url = str_replace( '448', $w, $url ); if ( ( 0 === strpos( $url, 'http://' ) ) || ( 0 === strpos( $url, 'https://' ) ) || ( 0 === strpos( $url, '//www' ) ) ) { echo apply_filters( 'the_content', $url ); $content = trim( str_replace( $url, '', $content ) ); } else if ( preg_match ( '#^<(script|iframe|embed|object)#i', $url ) ) { $h = get_option( 'embed_size_h' ); if ( !empty( $h ) ) { if ( $w === $h ) $h = ceil( $w * 0.75 ); $url = preg_replace( array( '#height="[0-9]+?"#i', '#height=[0-9]+?#i' ), array( sprintf( 'height="%d"', $h ), sprintf( 'height=%d', $h ) ), $url ); } echo $url; $content = trim( str_replace( $url, '', $content ) ); } } endif; ?>