yframework-style', get_stylesheet_uri(), array(), '2.3.1' ); // 5.4 - Load the Internet Explorer specific stylesheet. wp_enqueue_style( 'tinyframework-ie', get_template_directory_uri() . '/css/ie.css', array( 'tinyframework-style' ), '2.3.1' ); wp_style_add_data( 'tinyframework-ie', 'conditional', 'lt IE 9' ); // 5.4b - Load html5 shiv to add support for HTML5 elements in older IE versions. wp_enqueue_script( 'tinyframework-html5', get_template_directory_uri() . '/js/html5shiv.min.js', array(), '3.7.3' ); wp_script_add_data( 'tinyframework-html5', 'conditional', 'lt IE 9' ); // 5.5 - Add JavaScript to pages with the comment form to support sites with threaded comments (when in use). if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } // 5.6 - Add JavaScript for handling the navigation menu hide-and-show behavior. wp_enqueue_script( 'tinyframework-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '2.3.1', true ); // Loading script in the footer for a better performance // 5.7 - Add additional scripts for accessibility, etc. wp_enqueue_script( 'tinyframework-additional-scripts', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '2.3.1', true ); // Loading script in the footer for a better performance // Localize those scripts $translation_array = array( 'newWindow' => esc_html__( 'Opens in a new window', 'tiny-framework' ), ); wp_localize_script( 'tinyframework-additional-scripts', 'tinyframeworkAdditionalScripts', $translation_array ); /* 5.8 - Make "skip to content" link work correctly in IE9, Chrome, and Opera for better accessibility. * This function might be removed in the future, when browser accessibility support will become better. */ wp_enqueue_script( 'tinyframework-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '2.3.1', true ); // Loading script in the footer for a better performance } add_action( 'wp_enqueue_scripts', 'tinyframework_scripts_styles' ); /** * 5.9 - Add preconnect for Google Fonts. * * @since Tiny Framework 2.2.1 * * @param array $urls URLs to print for resource hints. * @param string $relation_type The relation type the URLs are printed. * @return array URLs to print for resource hints. */ function tinyframework_resource_hints( $urls, $relation_type ) { if ( wp_style_is( 'tinyframework-fonts', 'queue' ) && 'preconnect' === $relation_type ) { // WordPress versions 4.7+ include a crossorigin attribute, earlier versions will not. if ( version_compare( $GLOBALS['wp_version'], '4.7-alpha', '>=' ) ) { $urls[] = array( 'href' => 'https://fonts.gstatic.com', 'crossorigin', ); } else { $urls[] = 'https://fonts.gstatic.com'; } } return $urls; } add_filter( 'wp_resource_hints', 'tinyframework_resource_hints', 10, 2 ); // 6.0 - Add optional meta tags, scripts to head. function tinyframework_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"; /* jQuery - Google, then WordPress's. * * The Google CDN version is chosen because it's fast in absolute terms and it has the best overall penetration which increases the odds * of having a copy of the library in your user's browser cache link: https://github.com/h5bp/html5-boilerplate/blob/master/dist/doc/html.md * * You can do this, but it is not the best option, better use the plugin: https://wordpress.org/extend/plugins/use-google-libraries/ * Explanation why: https://pippinsplugins.com/why-loading-your-own-jquery-is-irresponsible/ */ /* if ( !is_admin() ) { wp_deregister_script( 'jquery' ); wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.12.3/jquery.min.js', false, '1.12.3', true ); wp_enqueue_script( 'jquery' ); } */ } add_action( 'wp_head', 'tinyframework_add_meta_to_head' ); if ( ! function_exists( 'tinyframework_the_title_trim' ) ) : /** * 7.0 - Enhancements for posts. * * 7.1 - 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. */ function tinyframework_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 'Protected article:', // What to replace "Private:" with 'Private article:' ); $title = preg_replace($findthese, $replacewith, $title); return $title; } endif; add_filter( 'the_title', 'tinyframework_the_title_trim' ); /** * 7.2 - 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). * * @link https://codex.wordpress.org/Template_Tags/the_excerpt */ /* function tinyframework_custom_excerpt_length( $length ) { return 25; } add_filter( 'excerpt_length', 'tinyframework_custom_excerpt_length', 999 ); */ /** * 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 Framework 1.0 */ function tinyframework_page_menu_args( $args ) { if ( ! isset( $args['show_home'] ) ) { $args['show_home'] = true; } return $args; } add_filter( 'wp_page_menu_args', 'tinyframework_page_menu_args' ); // 9.0 - Footer credits - Tip87 - Action Hook implementation example. function tinyframework_display_credits() { /* translators: %s: Theme name. */ $text = sprintf( esc_html__( 'Using %s', 'tiny-framework' ), 'Tiny Framework ' ); // If you would like to use long version of credits, use these two lines below (and delete the line above): /* $text = sprintf( esc_html__( 'Powered by %s', 'tiny-framework' ), 'WordPress' ); $text .= sprintf( esc_html__( ' and %s', 'tiny-framework' ), 'Tiny Framework ' ); */ $text .= ''; // If you want to add your own credits: /* $text .= ' Web development by your credentials '; $text .= ''; */ echo apply_filters( 'tinyframework_credits_text', $text ); } add_action( 'tinyframework_credits', 'tinyframework_display_credits' ); // 10.0 - Functions to optimize performance. "The fastest HTTP request is the one not made." // Functions moved to a Child Example theme that can be found in: inc/examples/tiny-framework-child.zip // 11.0 - Functions to increase security. // Functions moved to a Child Example theme that can be found in: inc/examples/tiny-framework-child.zip /** * 12.0 - Other functions. * * 12.1 - Tip08 - Remove junk from head. */ // Functions moved to a Child Example theme that can be found in: inc/examples/tiny-framework-child.zip // 12.2 - Tip82 - No more jumping for read more link. // Functions moved to a Child Example theme that can be found in: inc/examples/tiny-framework-child.zip /** * 12.3 - Tip28 - Remove curly quotes in WordPress. For more options: * * @link http://www.smashingmagazine.com/2013/06/21/five-wordpress-functions-blogging-easier/ */ remove_filter( 'the_content', 'wptexturize' ); remove_filter( 'the_excerpt', 'wptexturize' ); remove_filter( 'comment_text', 'wptexturize' ); // 12.4 - Tip81 - Completely disable the Post Formats support in the theme and Post Formats UI in the post editor screen. // Functions moved to a Child Example theme that can be found in: inc/examples/tiny-framework-child.zip // 12.5 - Add again default attachment image class attributes. See: https://core.trac.wordpress.org/ticket/36996#comment:3 function tinyframework_add_again_default_attach_image_class_attr( $attr, $attach, $size ) { // The class to test. // Solution was discussed at: https://wordpress.org/support/topic/need-help-with-fixing-core-bug/ if ( is_array( $size ) ) { $size = "$size[0]x$size[1]"; $classes = 'attachment-' . $size . ' size-' . $size; } else { $classes = 'attachment-' . $size . ' size-' . $size; } // Add the wp classes if not founds. if ( isset( $attr['class'] ) && false === strpos( $attr['class'], $classes ) ) { $attr['class'] .= ' ' . $classes; } return $attr; } add_filter( 'wp_get_attachment_image_attributes', 'tinyframework_add_again_default_attach_image_class_attr', 10, 3 ); /** * 13.0 - Additional strings available for translation. * * Some of these strings might be included in the child themes or in the parent theme as commented-out code. * * @link https://core.trac.wordpress.org/browser/tags/4.5.2/src/wp-admin/credits.php?marks=114-124#L113 */ /* translators: %s: CMS name, i.e. WordPress. */ esc_html__( 'Powered by %s', 'tiny-framework' ); /* translators: %s: Theme name. */ esc_html__( ' and %s', 'tiny-framework' );