This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo '<div class="entry-meta">'; | |
| if ( is_single() ) { | |
| twentyseventeen_posted_on(); | |
| } else { | |
| echo twentyseventeen_time_link(); | |
| twentyseventeen_edit_link(); | |
| }; | |
| echo '<div id="word-count">This post contains ' . word_count() . ' words.</div>'; | |
| echo '</div><!-- .entry-meta -->'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo '<div id="reading-time">This post will take you about ' . reading_time() . ' to read.</div>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function delay_rss_feed($where) { | |
| global $wpdb; | |
| if ( is_feed() ) { | |
| $now = gmdate('Y-m-d H:i:s'); | |
| $wait = '10'; | |
| $device = 'MINUTE'; | |
| $where.= " AND TIMESTAMPDIFF($device, $wpdb->posts.post_date_gmt, '$now') > $wait "; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function display_last_updated_date() { | |
| $u_time = get_the_time('U'); | |
| $u_modified_time = get_the_modified_time('U'); | |
| if ($u_modified_time >= $u_time + 86400) { | |
| $updated_date = get_the_modified_time('F jS, Y'); | |
| echo '<div class="last-updated">This post was last updated on ' , $updated_date , '.</div>'; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function reading_time() { | |
| $content = get_post_field( 'post_content', $post->ID ); | |
| $word_count = str_word_count( strip_tags( $content ) ); | |
| $readingtime = ceil($word_count / 200); | |
| if ($readingtime == 1) { | |
| $timer = " minute"; | |
| } else { | |
| $timer = " minutes"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo '<div class="word-count">This post contains ' . word_count() . ' words.</div>'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function obscure_login_errors(){ | |
| return "That wasn't quite right..."; | |
| } | |
| add_filter( 'login_errors', 'obscure_login_errors' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function add_googleanalytics() { ?> | |
| <script async src="https://www.googletagmanager.com/gtag/js?id=XX-XXXXXXXX-X"></script> | |
| <script> | |
| window.dataLayer = window.dataLayer || []; | |
| function gtag(){dataLayer.push(arguments);} | |
| gtag('js', new Date()); | |
| gtag('config', 'XX-XXXXXXXX-X'); | |
| </script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function conditionally_remove_admin_bar() { | |
| if (!current_user_can('administrator') && !is_admin()) { | |
| show_admin_bar(false); | |
| } | |
| } | |
| add_action('after_setup_theme', 'conditionally_remove_admin_bar'); |
NewerOlder