'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'); // Localisation Support load_theme_textdomain('iotheme', get_template_directory() . '/languages'); } add_filter( 'image_size_names_choose', 'iotheme_add_custom_sizes' ); function iotheme_add_custom_sizes( $sizes ) { return array_merge( $sizes, array( 'team-small' => __( 'Team' ), ) ); } /*------------------------------------*\ Functions \*------------------------------------*/ // IO Theme navigation function iotheme_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 $output; } // Custom View Article link to Post function html5_blank_view_article($more) { global $post; return '... ' . __('View Article', 'iotheme') . ''; } // 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 iothemegravatar ($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 iothemecomments($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('image_send_to_editor', 'remove_thumbnail_dimensions', 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 io-publication // function create_post_type_iotheme() // { // register_taxonomy_for_object_type('category', 'io-publication'); // Register Taxonomies for Category // register_taxonomy_for_object_type('post_tag', 'io-publication'); // register_post_type('io-publication', // Register Custom Post Type // array( // 'labels' => array( // 'name' => __('Publications', 'iotheme'), // Rename these to suit // 'singular_name' => __('Publication', 'iotheme'), // 'add_new' => __('Add New', 'iotheme'), // 'add_new_item' => __('Add New Publication', 'iotheme'), // 'edit' => __('Edit', 'iotheme'), // 'edit_item' => __('Edit Publication', 'iotheme'), // 'new_item' => __('New Publication', 'iotheme'), // 'view' => __('View Publication', 'iotheme'), // 'view_item' => __('View Publication', 'iotheme'), // 'search_items' => __('Search Publication', 'iotheme'), // 'not_found' => __('No Publications found', 'iotheme'), // 'not_found_in_trash' => __('No Publications found in Trash', 'iotheme') // ), // '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 IO Theme 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 '