for posts and comments. * 3.4 - Switches default core markup for search form, comment form, and comments to output valid HTML5. * 3.5 - This theme supports a variety of post formats. * 3.6 - This theme uses wp_nav_menu() in one location. * 3.7 - This theme supports custom background color and image, and here we also set up the default background color. * 3.8 - This theme uses a custom image size for featured images, displayed on "standard" posts (also see Tip06 in style.css). * 3.9 - Tip07 - Add new image size for custom post/page headers and select default header image (also see Tip06 in style.css). * 3.9b - Let WordPress manage the document title. * 3.10 - Register sidebars. Register our main widget area, footer widget areas and the front page widget areas. * 3.11 - Allow Schema.org attributes to be added to HTML tags in the editor (but not for comments). * 3.12 - Add Theme Customizer components. * 4.0 - Return the Google font stylesheet URL if available. * 5.0 - Enqueue scripts and styles for front-end. * 5.1 - Add JavaScript to pages with the comment form to support sites with threaded comments (when in use). * 5.2 - Add JavaScript for handling the navigation menu hide-and-show behavior. * 5.3 - Load Google Open Sans font stylesheet URL. * 5.4 - Tip31 - Google Fonts support. Load Google Fonts stylesheet - disabled by default. * 5.5 - Load our main stylesheet. * 5.6 - Load the Internet Explorer specific stylesheet. * 5.7 - Add CSS file of the Elusive-icon font. * 5.8 - Filter TinyMCE CSS path to include Google Fonts. Add additional stylesheets to the TinyMCE editor if needed. * 5.9 - Add optional meta tags, scripts to head - disabled by default. * 5.9b - Tip02 - Optional code to enable favicon for the website, admin area and login page. Add favicon.ico file to the theme's /images folder - disabled by default. * 5.10 - Change title for protected and private posts - words "protected" and "private" are replaced by lock/lock and user symbols. * 5.11 - Add "...continue reading" link for the Excerpts. * 5.12 - Control the length of Excerpts (number of words) - disabled by default. * 6.0 - Extend the default WordPress CSS classes. * 6.1 - Additional body classes - add category (or any other taxonomy) class for single posts. * 6.2 - Additional body classes - add Page Slug class. * 6.3 - Additional post classes - add a post class to denote Non-password protected page with a post thumbnail. * 7.0 - . * 8.0 - Navigation settings. * 8.1 - Filter the page menu arguments. Make our wp_nav_menu() fallback -- wp_page_menu() -- show a home link. * 8.2 - Display navigation to next/previous pages when applicable. * 9.0 - Adjust content width in certain contexts. Adjust content_width value for full-width and single image attachment templates, and when there are no active widgets in the sidebar. * 10.0 - Content meta information. * 10.1 - Tip26 - Set up post entry meta. Print HTML bellow post title with meta information for the current post date/time and author. * 10.2 - Set up post entry meta. Print HTML with meta information for current post: categories, tags, permalink, author, and date. * 11.0 - Comments and pingbacks. * 11.1 - Template for comments and pingbacks. * 11.2 - Add Schema.org author markup to comment author links. * 12.0 - Other functions. * 12.1 - Tip82 - No more jumping for read more link - disabled by default. * 12.2 - Tip28 - Remove curly quotes in WordPress. * 12.3 - Tip23 - Properly resize videos, inserted with oembed. * 12.4 - Tip81 - Completely disable the Post Formats UI in the post editor screen - disabled by default. * 12.5 - Tip08 - Remove junk from head - disabled by default. * 12.6 - Tip09 - Remove WordPress version info from head and feeds - better for security reasons - disabled by default. * 12.7 - Tip84 - Remove error message on the login page - better for security reasons - disabled by default. * 12.8 - Tip34 - Display author info card at the bottom of posts on a single author website - disabled by default. * 13.0 - Temporary and deprecated functions. * * ---------------------------------------------------------------------------- */ // 1.0 - Set up the content width value based on the theme's design and stylesheet. if ( ! isset( $content_width ) ) { $content_width = 625; } // 2.0 - Add support for a custom header image. require( get_template_directory() . '/inc/custom-header.php' ); // 2.1 - Add back-compatibility. require( get_template_directory() . '/inc/back-compat.php' ); /** * 3.0 - Tiny Forge setup * * Set up theme defaults and register the various WordPress features that Tiny Forge supports. * * @uses load_theme_textdomain() For translation/localization support. * @uses add_editor_style() To add a Visual Editor stylesheet. * @uses add_theme_support() To add support for post thumbnails, automatic feed links, * custom background, and post formats. * @uses register_nav_menu() To add support for navigation menus. * @uses set_post_thumbnail_size() To set a custom post thumbnail size. * * @since Tiny Forge 1.0 */ if ( ! function_exists( 'tinyforge_setup' ) ) : function tinyforge_setup() { /* * 3.1 - Make Tiny Forge available for translation. * * Translations can be added to the /languages/ directory. * If you're building a theme based on Tiny Forge, use a find and replace * to change 'tinyforge' to the name of your theme in all the template files. */ load_theme_textdomain( 'tinyforge', get_template_directory() . '/languages' ); // 3.2 - This theme styles the visual editor with editor-style.css to match the theme style. add_editor_style( 'css/editor-style.css' ); // 3.3 - Add RSS feed links to
for posts and comments. add_theme_support( 'automatic-feed-links' ); // 3.4 - Switches default core markup for search form, comment form, comments, gallery, and captions to output valid HTML5. add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); // 3.5 - This theme supports a variety of post formats. See http://codex.wordpress.org/Post_Formats add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote', 'status', ) ); // other possible formats: 'audio', 'chat', 'gallery', 'video' // 3.6 - This theme uses wp_nav_menu() in one location. register_nav_menu( 'primary', __( 'Primary Menu', 'tinyforge' ) ); // 3.7 - This theme supports custom background color and image, and here we also set up the default background color. add_theme_support( 'custom-background', array( 'default-color' => 'e6e6e6', // Other custom background settings you might want to use: /* 'default-image' => get_template_directory_uri() . '/images/background.jpg', 'default-repeat' => 'no-repeat', 'default-position-x' => 'center', 'default-attachment' => 'fixed', */ ) ); /* 3.8 - This theme uses a custom image size for featured images, displayed on "standard" posts. * See http://wordpress.stackexchange.com/questions/108572/set-post-thumbnail-size-vs-add-image-size */ add_theme_support( 'post-thumbnails' ); /* Set standard Post Thumbnail size. If size is not specified, WordPress will use 'thumb' image size, one that is setted from WordPress dashboard. * Standard Post Thumbnail can be inserted with */ // set_post_thumbnail_size( 220, 129 ); // 220px x 126px . Commenting out for the time being. Perhaps will use it to display featured posts in the index, when Featured Content functionality will be added to the WP core. // 3.9 - Tip07 - Add new image size for custom post/page headers and select default header image. add_image_size( 'custom-header-image', 960, 9999 ); // Unlimited height, soft crop /* 3.9b - Let WordPress manage the document title. Also see /inc/back-compat.php. * * By adding theme support, we declare that this theme does not use a * hard-codedTesting google fonts
* * Uncomment next PHP block to enable Google Fonts support. Also see 5.5 and load main stylesheet with dependency on tinyforge-google-fonts. */ /* if ( !is_admin() ) { // we do not want this to load in the dashboard wp_register_style( 'tinyforge-google-fonts', 'http://fonts.googleapis.com/css?family=Bigelow+Rules', '', '', 'screen' ); } // Enqueue Google Fonts stylesheet wp_enqueue_style( 'tinyforge-google-fonts' ); */ // 5.5 - Load our main stylesheet. wp_enqueue_style( 'tinyforge-style', get_stylesheet_uri(), array(), '1.6.1' ); // If you are using Google fonts, use instead next line to load main stylesheet (of course comment-out the one above): /* // 5.5 - Load our main stylesheet. wp_enqueue_style( 'tinyforge-style', get_stylesheet_uri(), array( 'tinyforge-google-fonts' ), '1.6.1' ); */ // 5.6 - Load the Internet Explorer specific stylesheet. wp_enqueue_style( 'tinyforge-ie', get_template_directory_uri() . '/css/ie.css', array( 'tinyforge-style' ), '1.5' ); $wp_styles->add_data( 'tinyforge-ie', 'conditional', 'lt IE 9' ); // 5.7 - Add CSS file of the Elusive-icon font. wp_enqueue_style( 'elusive-iconfont-style', get_template_directory_uri() . '/css/elusive-webfont.css', array(), '1.5', 'all' ); } add_action( 'wp_enqueue_scripts', 'tinyforge_scripts_styles' ); /** * 5.8 - Filter TinyMCE CSS path to include Google Fonts. * * Add additional stylesheets to the TinyMCE editor if needed. * * @uses tinyforge_get_font_url() To get the Google Font stylesheet URL. * * @since Tiny Forge 1.2 * * @param string $mce_css CSS path to load in TinyMCE. * @return string Filtered CSS path. */ function tinyforge_mce_css( $mce_css ) { $font_url = tinyforge_get_font_url(); if ( empty( $font_url ) ) { return $mce_css; } if ( ! empty( $mce_css ) ) { $mce_css .= ','; } $mce_css .= esc_url_raw( str_replace( ',', '%2C', $font_url ) ); return $mce_css; } add_filter( 'mce_css', 'tinyforge_mce_css' ); // 5.9 - Add optional meta tags, scripts to head. function tinyforge_add_meta_to_head () { // Tip03 - We are people, not machines. Read more at: humanstxt.org. Edit file humans.txt to include your information. // echo "\n"; echo ''; echo "\n"; echo ''; echo "\n"; // Project author's information // echo ''; echo "\n\n"; // Jquery - Google, then WordPress's /* if (!is_admin()) { wp_deregister_script('jquery'); wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', false, '1.8.3', true); wp_enqueue_script('jquery'); } */ } add_action('wp_head', 'tinyforge_add_meta_to_head'); // 5.9b - Tip02 - Optional code to enable favicon for the website, admin area and login page. Add favicon.ico file to the theme's /images folder. /* function tinyforge_favicon() { $favicon_url = get_template_directory_uri() . '/images/favicon.ico'; echo "\n"; echo ''; echo "\n"; } add_action('wp_head', 'tinyforge_favicon'); // Favicon for main website add_action('admin_head', 'tinyforge_favicon'); // Favicon for admin area add_action('login_head', 'tinyforge_favicon'); // Favicon for login page */ /** * 5.10 - Change title for protected and private posts - words "protected" and "private" are replaced by lock symbol. * * If you're using localized WordPress, replace words 'Protected' and 'Private' with the corresponding words in your language. * * If you're using child theme, uncomment function 1.3 in child theme's functions.php and replace words 'Protected' and 'Private' with the corresponding words in your language. */ if ( ! function_exists( 'tinyforge_the_title_trim' ) ) : function tinyforge_the_title_trim($title) { $title = esc_attr($title); // Sanitize HTML characters in the title. Comment out this line if you want to use HTML in post titles. $findthese = array( '#Protected:#', '#Private:#' ); $replacewith = array( '', // What to replace "Protected:" with ' ' // What to replace "Private:" with ); $title = preg_replace($findthese, $replacewith, $title); return $title; } endif; add_filter('the_title', 'tinyforge_the_title_trim'); /** * 5.11 - Add "...continue reading" link for the Excerpts. Please note, that Excerpt is not a Teaser (the part of a post that appears on the front page when you use the More tag). * * Note that if you have also placed the More tag and it was placed before the minimum count of words needed for Excerpt, "...continue reading" link for the Excerpt will not be displayed. * * If that happens, you can use the function below to adjust the Excerpt length. By default automatic Excerpt shows the first 55 words of the post's content. * * Read more about excerpts at: http://codex.wordpress.org/Template_Tags/the_excerpt */ if ( ! function_exists( 'tinyforge_new_excerpt_more' ) ) : function tinyforge_new_excerpt_more( $more ) { return ' ' . __('...continue reading ', 'tinyforge') . ''; } endif; add_filter( 'excerpt_more', 'tinyforge_new_excerpt_more' ); /** * 5.12 - Control the length of Excerpts (number of words). Please note, that Excerpt is not a Teaser (the part of a post that appears on the front page when you use the More tag). * * Read more about this function at: http://codex.wordpress.org/Template_Tags/the_excerpt */ /* function tinyforge_custom_excerpt_length( $length ) { return 25; } add_filter( 'excerpt_length', 'tinyforge_custom_excerpt_length', 999 ); */ /** * 6.0 - Extend the default WordPress CSS classes to denote: * * @since Tiny Forge 1.0 * * param array $classes Existing class values. * * @return array Filtered class values. */ if ( ! function_exists( 'tinyforge_body_class' ) ) : function tinyforge_body_class( $classes ) { $background_color = get_background_color(); $background_image = get_background_image(); // Using a full-width layout, when no active widgets in the sidebar or full-width template. if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'page-templates/full-width.php' ) || is_attachment() ) { $classes[] = 'full-width'; } // Front Page template: thumbnail in use and number of sidebars for widget areas. if ( is_page_template( 'page-templates/front-page.php' ) ) { $classes[] = 'template-front-page'; if ( has_post_thumbnail() ) { $classes[] = 'has-post-thumbnail'; } if ( is_active_sidebar( 'sidebar-2' ) && is_active_sidebar( 'sidebar-3' ) ) { $classes[] = 'two-sidebars'; } } // White or empty background color to change the layout and spacing. if ( empty( $background_image ) ) { if ( empty( $background_color ) ) { $classes[] = 'custom-background-empty'; } elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) ) { $classes[] = 'custom-background-white'; } } // Enable custom font class only if the font CSS is queued to load. if ( wp_style_is( 'tinyforge-fonts', 'queue' ) ) { $classes[] = 'custom-font-enabled'; } // Single or multiple authors. if ( ! is_multi_author() ) { $classes[] = 'single-author'; } // Index, archive views. if ( is_archive() || is_search() || is_home() ) { $classes[] = 'list-view'; } // Single views. is_singular applies when one of the following returns true: is_single(), is_page() or is_attachment() if ( is_singular() && ! is_front_page() ) { $classes[] = 'singular'; } // Presence of header image. if ( get_header_image() ) { $classes[] = 'header-image-yes'; } else { $classes[] = 'header-image-no'; } // Presence of footer widget(s). if ( is_active_sidebar( 'sidebar-4' ) || is_active_sidebar( 'sidebar-5' ) || is_active_sidebar( 'sidebar-6' ) ) { $classes[] = 'footer-widgets'; } return $classes; } endif; add_filter( 'body_class', 'tinyforge_body_class' ); /** * 6.1 - Additional body classes - add category (or any other taxonomy) class for single posts. * * @since Tiny Forge 1.5.4 * * Add category (or any other taxonomy - controlled with conditionals) nicenames in BODY class for single posts. By Brian Krogsgard. * Handy if you want to make CSS changes on a per-post or archive basis depending on the term it relates to. * http://www.organizedthemes.com/body-class-tricks-for-wordpress-sites/#comment-315 */ function tinyforge_tax_body_class( $classes ) { if ( is_singular('post') || is_category() ) { global $post; $terms = get_the_terms( $post->ID, 'category' ); if ( $terms && ! is_wp_error( $terms ) ) { foreach ( $terms as $term ) { // assign body class for the blog categories $classes[] =$term->slug; } } } return $classes; } add_filter('body_class', 'tinyforge_tax_body_class'); /** * 6.2 - Additional body classes - add Page slug class. * * @since Tiny Forge 1.5.4 * * http://www.wpbeginner.com/wp-themes/how-to-add-page-slug-in-body-class-of-your-wordpress-themes/ */ function tinyforge_page_slug_body_class( $classes ) { global $post; if ( isset( $post ) ) { $classes[] = $post->post_type . '-' . $post->post_name; } return $classes; } add_filter( 'body_class', 'tinyforge_page_slug_body_class' ); /** * 6.3 - Additional post classes - add a post class to denote Non-password protected page with a post thumbnail. * * @since Tiny Forge 1.5.4 * * @param array $classes A list of existing post class values. * @return array The filtered post class list. */ function tinyforge_post_classes( $classes ) { if ( ! post_password_required() && has_post_thumbnail() ) { $classes[] = 'has-thumbnail'; } return $classes; } add_filter( 'post_class', 'tinyforge_post_classes' ); /** * 7.0 - . */ /** * 8.0 - Navigation settings. * * 8.1 - Filter the page menu arguments. * * Make our wp_nav_menu() fallback -- wp_page_menu() -- show a home link. * * @since Tiny Forge 1.0 */ function tinyforge_page_menu_args( $args ) { if ( ! isset( $args['show_home'] ) ) { $args['show_home'] = true; } return $args; } add_filter( 'wp_page_menu_args', 'tinyforge_page_menu_args' ); /** * 8.2 - Displays navigation to next/previous pages when applicable. * * @since Tiny Forge 1.0 */ if ( ! function_exists( 'tinyforge_content_nav' ) ) : function tinyforge_content_nav( $html_id ) { global $wp_query; if ( $wp_query->max_num_pages > 1 ) : ?> %3$s', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'tinyforge' ), get_the_author() ) ), get_the_author() ); $date = sprintf( '', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); // Translators: 1 is the date and 2 is the author's name $utility_text = __( ' %1$s ', 'tinyforge' ); printf( $utility_text, $date, $author ); } endif; /** * 10.2 - Set up post entry meta. Print HTML with meta information for current post: categories, tags, permalink, author, and date. * * Create your own tinyforge_entry_meta() to override in a child theme. * * @since Tiny Forge 1.0 */ if ( ! function_exists( 'tinyforge_entry_meta' ) ) : function tinyforge_entry_meta() { // Translators: used between list items, there is a space after the comma $categories_list = get_the_category_list( __( ', ', 'tinyforge' ) ); // Translators: used between list items, there is a space after the comma $tag_list = get_the_tag_list( '', __( ', ', 'tinyforge' ) ); $date = sprintf( '', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $author = sprintf( '', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'tinyforge' ), get_the_author() ) ), get_the_author() ); // Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name. if ( $tag_list ) { $utility_text = __( 'Posted in %1$s. Tags: %2$s on %3$s.', 'tinyforge' ); } elseif ( $categories_list ) { $utility_text = __( 'Posted in %1$s on %3$s.', 'tinyforge' ); } else { $utility_text = __( 'Posted on %3$s.', 'tinyforge' ); } printf( $utility_text, $categories_list, $tag_list, $date, $author ); } endif; /** * 11.0 - Comments and pingbacks. * * 11.1 - Template for comments and pingbacks. * * To override this walker in a child theme without modifying the comments template * simply create your own tinyforge_comment(), and that function will be used instead. * * Used as a callback by wp_list_comments() for displaying the comments. * * @since Tiny Forge 1.0 */ if ( ! function_exists( 'tinyforge_comment' ) ) : function tinyforge_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case 'pingback' : case 'trackback' : // Display trackbacks differently than normal comments ?>', '