Adding Custom Text To Your Website’s Login Page
Simply paste the following snippet in your theme’s functions.php file while to customize the message, you can do on line 3.
1 2 3 4 5 6 7 8 |
function wps_login_message( $message ) { if ( empty($message) ){ return "<p class='message'>Welcome to this site. Please log in to continue</p>"; } else { return $message; } } add_filter( 'login_message', 'wps_login_message' ); |
Snippet Source/Credit: WP Snippy
How To Show A Short Intro Of The Author Bio
In order to achieve this, all you have to do is to simply copy and paste the following snippet into your theme’s functions.php file.
1 2 3 4 5 6 7 8 9 10 11 |
<?php 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')); $authorDescriptionShort = wp_trim_words(strip_tags(get_the_author_meta('description')), $word_limit, $txt_end.'<br /> '.$more_txt.' <a href="'.$authorUrl.'">'.$authorName.'</a>'); return $authorDescriptionShort; } ?> |
Remember a thing more, once added the above snippet, add the following line of code at the place where you want to display a short introduction of the author byline:
1 |
<?php if (function_exists('author_excerpt')){echo author_excerpt();} ?> |
Snippet Source/Credit: Tim Marcher
Changing Contents Of A Dashboard Tab
Just, simply paste the snippet below into your functions.php file.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
add_action('load-page-new.php','add_custom_help_page'); add_action('load-page.php','add_custom_help_page'); function add_custom_help_page() { //the contextual help filter add_filter('contextual_help','custom_page_help'); } function custom_page_help($help) { //keep the existing help copy echo $help; //add some new copy echo "<h5>Custom Features</h5>"; echo "<p>Content placed above the more divider will appear in column 1. Content placed below the divider will appear in column 2.</p>"; } |
Snippet Source/Credit: WP Tuts
How To Add A Breadcrumb To Your Blog
Simply paste the following code to your functions.php file and you are done.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
function the_breadcrumb() { echo '<ul id="crumbs">'; if (!is_home()) { echo '<li><a href="'; echo get_option('home'); echo '">'; echo 'Home'; echo "</a></li>"; if (is_category() || is_single()) { echo '<li>'; the_category(' </li><li> '); if (is_single()) { echo "</li><li>"; the_title(); echo '</li>'; } } elseif (is_page()) { echo '<li>'; echo the_title(); echo '</li>'; } } elseif (is_tag()) {single_tag_title();} elseif (is_day()) {echo"<li>Archive for "; the_time('F jS, Y'); echo'</li>';} elseif (is_month()) {echo"<li>Archive for "; the_time('F, Y'); echo'</li>';} elseif (is_year()) {echo"<li>Archive for "; the_time('Y'); echo'</li>';} elseif (is_author()) {echo"<li>Author Archive"; echo'</li>';} elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {echo "<li>Blog Archives"; echo'</li>';} elseif (is_search()) {echo"<li>Search Results"; echo'</li>';} echo '</ul>'; |
Once done, call the following function by opening header.php:
1 |
<?php the_breadcrumb(); ?> |
Snippet Source/Credit: emoticode
Setting The Default Image Size In WordPress Galleries
Simply using the following snippet which you have to paste in your theme’s functions.php file with which you can set the default image size in your built-in WordPress galleries.
1 2 3 4 5 6 |
remove_shortcode('gallery'); add_shortcode('gallery', 'custom_size_gallery'); function custom_size_gallery($attr) { $attr['size'] = 'medium'; return gallery_shortcode($attr); } |
Snippet Source/Credit: emoticode
Adding Paragraph Tags Automatically In Your WordPress Blog
Using the wpautop() function, WordPress itself add paragraph tag to the content as well as the excerpt BUT if you wish to make an addition to this by adding paragraph tags to any text, simply add the following snippet and you are done.
1 2 3 4 |
$my_text = 'Lorem ipsum dolor sit amet consectetur adipiscing elit. Nulla pretium libero eget gravida rutrum.'; echo wpautop( $my_text ); |
Snippet Source/Credit: Daniel Pataki