'FFF', 'default-image' => get_template_directory_uri() . '/img/bg.jpg' ));*/ // Add Support for Custom Header - Uncomment below if you're going to use. /*add_theme_support('custom-header', array( 'default-image' => get_template_directory_uri() . '/img/headers/default.jpg', 'header-text' => false, 'default-text-color' => '000', 'width' => 1000, 'height' => 198, 'random-default' => false, 'wp-head-callback' => $wphead_cb, 'admin-head-callback' => $adminhead_cb, 'admin-preview-callback' => $adminpreview_cb ));*/ // Enables post and comment RSS feed links to head. add_theme_support( 'automatic-feed-links' ); // Enable HTML5 support. add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption' ) ); // Localisation Support. load_theme_textdomain( 'html5blank', get_template_directory() . '/languages' ); } /*------------------------------------*\ Functions \*------------------------------------*/ // HTML5 Blank navigation function html5blank_nav() { wp_nav_menu( array( 'theme_location' => 'header-menu', 'menu' => '', 'container' => 'div', 'container_class' => 'menu-{menu slug}-container', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '
' . $output . '
'; echo esc_html( $output ); } // Custom View Article link to Post function html5_blank_view_article( $more ) { global $post; return '... ' . esc_html_e( 'View Article', 'html5blank' ) . ''; } // Remove Admin bar function remove_admin_bar() { return false; } // Remove 'text/css' from our enqueued stylesheet function html5_style_remove( $tag ) { return preg_replace( '~\s+type=["\'][^"\']++["\']~', '', $tag ); } // Remove thumbnail width and height dimensions that prevent fluid images in the_thumbnail function remove_thumbnail_dimensions( $html ) { $html = preg_replace( '/(width|height)=\"\d*\"\s/', '', $html ); return $html; } // Custom Gravatar in Settings > Discussion function html5blankgravatar ( $avatar_defaults ) { $myavatar = get_template_directory_uri() . '/img/gravatar.jpg'; $avatar_defaults[$myavatar] = 'Custom Gravatar'; return $avatar_defaults; } // Threaded Comments function enable_threaded_comments() { if ( ! is_admin() ) { if ( is_singular() AND comments_open() AND ( get_option( 'thread_comments' ) == 1 ) ) { wp_enqueue_script( 'comment-reply' ); } } } // Custom Comments Callback function html5blankcomments( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; extract( $args, EXTR_SKIP ); if ( 'div' == $args['style'] ) { $tag = 'div'; $add_below = 'comment'; } else { $tag = 'li'; $add_below = 'div-comment'; } ?> < id="comment-">
tags in Dynamic Sidebars (better!) add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' ); // Remove surrounding
tags in Excerpt (Manual Excerpts only) add_filter( 'the_excerpt', 'do_shortcode' ); // Allows Shortcodes to be executed in Excerpt (Manual Excerpts only) add_filter( 'excerpt_more', 'html5_blank_view_article' ); // Add 'View Article' button instead of [...] for Excerpts add_filter( 'show_admin_bar', 'remove_admin_bar' ); // Remove Admin bar add_filter( 'style_loader_tag', 'html5_style_remove' ); // Remove 'text/css' from enqueued stylesheet add_filter( 'post_thumbnail_html', 'remove_thumbnail_dimensions', 10 ); // Remove width and height dynamic attributes to thumbnails add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 ); // Remove width and height dynamic attributes to post images add_filter( 'image_send_to_editor', 'remove_width_attribute', 10 ); // Remove width and height dynamic attributes to post images // Remove Filters remove_filter( 'the_excerpt', 'wpautop' ); // Remove
tags from Excerpt altogether // Shortcodes add_shortcode( 'html5_shortcode_demo', 'html5_shortcode_demo' ); // You can place [html5_shortcode_demo] in Pages, Posts now. add_shortcode( 'html5_shortcode_demo_2', 'html5_shortcode_demo_2' ); // Place [html5_shortcode_demo_2] in Pages, Posts now. // Shortcodes above would be nested like this - // [html5_shortcode_demo] [html5_shortcode_demo_2] Here's the page title! [/html5_shortcode_demo_2] [/html5_shortcode_demo] /*------------------------------------*\ Custom Post Types \*------------------------------------*/ // Create 1 Custom Post type for a Demo, called HTML5-Blank function create_post_type_html5() { register_taxonomy_for_object_type( 'category', 'html5-blank' ); // Register Taxonomies for Category register_taxonomy_for_object_type( 'post_tag', 'html5-blank' ); register_post_type( 'html5-blank', // Register Custom Post Type array( 'labels' => array( 'name' => esc_html( 'HTML5 Blank Custom Post', 'html5blank' ), // Rename these to suit 'singular_name' => esc_html( 'HTML5 Blank Custom Post', 'html5blank' ), 'add_new' => esc_html( 'Add New', 'html5blank' ), 'add_new_item' => esc_html( 'Add New HTML5 Blank Custom Post', 'html5blank' ), 'edit' => esc_html( 'Edit', 'html5blank' ), 'edit_item' => esc_html( 'Edit HTML5 Blank Custom Post', 'html5blank' ), 'new_item' => esc_html( 'New HTML5 Blank Custom Post', 'html5blank' ), 'view' => esc_html( 'View HTML5 Blank Custom Post', 'html5blank' ), 'view_item' => esc_html( 'View HTML5 Blank Custom Post', 'html5blank' ), 'search_items' => esc_html( 'Search HTML5 Blank Custom Post', 'html5blank' ), 'not_found' => esc_html( 'No HTML5 Blank Custom Posts found', 'html5blank' ), 'not_found_in_trash' => esc_html( 'No HTML5 Blank Custom Posts found in Trash', 'html5blank' ), ), 'public' => true, 'hierarchical' => true, // Allows your posts to behave like Hierarchy Pages 'has_archive' => true, 'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail' ), // Go to Dashboard Custom HTML5 Blank post for supports 'can_export' => true, // Allows export in Tools > Export 'taxonomies' => array( 'post_tag', 'category' ) // Add Category and Post Tags support ) ); } /*------------------------------------*\ ShortCode Functions \*------------------------------------*/ // Shortcode Demo with Nested Capability function html5_shortcode_demo( $atts, $content = null ) { return '