Author Bio Excerpt
The snippet below will let you have the author bio excerpt.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<?php // Paste the code below to the functions.php file inside the theme directory you're using. function author_excerpt (){ $word_limit = 20; // Limit the number of words $more_txt = 'read more about:'; // The read more text $txt_end = '...'; // Display text end $authorName = get_the_author(); $authorUrl = get_author_posts_url( get_the_author_meta('ID')); $authorDescription = explode(" ", get_the_author_meta('description')); $displayAuthorPageLink = count($authorDescription) > $word_limit ? $txt_end.' '.$more_txt.' <a href="'.$authorUrl.'">'.$authorName.'</a>' : '' ; $authorDescriptionShort = array_slice($authorDescription, 0, ($word_limit)); return (implode($authorDescriptionShort, ' ')).$displayAuthorPageLink; } ?> <?php // Add this code snippet to the single.php file where you like to display the author bio excerpt. if (function_exists('author_excerpt')){echo author_excerpt();} ?> |
Disable Self Trackbacks
The following snippet will let you disable self trackbacks.
1 2 3 4 5 6 7 8 |
<?php function disable_self_ping( &$links ) { foreach ( $links as $l => $link ) if ( 0 === strpos( $link, get_option( 'home' ) ) ) unset($links[$l]); } add_action( 'pre_ping', 'disable_self_ping' ); ?> |
Remove Login Shake
The following snippet has to be added to functions.php and it will remove the “wrong password” screen shake.
1 2 3 4 5 6 |
<?php function my_login_head() { remove_action('login_head', 'wp_shake_js', 12); } add_action('login_head', 'my_login_head'); ?> |
Only Show Admin Bar To Administrators
The following snippet will let you show the admin bar to administrators.
1 2 3 4 5 6 |
<?php // Snippet code goes here! if (!current_user_can('administrator')) : show_admin_bar(false); endif; ?> |
QR Code With Article Link
To have the QR-code rendered for every article, just insert the following snippet inside the WordPress loop.
1 2 3 4 5 |
<img src="http://api.qrserver.com/v1/create-qr-code/?size=500x500&data=" <?php the_permalink() ?> " alt="QR Code for <?php the_title_attribute(); ?> "/> |