![]() ![]() This little gem makes it easy: // customize admin footer textĮcho 'Website Design by Awesome Example' Īdd_filter('admin_footer_text', 'custom_admin_footer') For your own sites and for your clients’ sites, it is nice to customize the generic admin footer message with something a little more useful, informative, and inspiring. Customize the admin footer messageĬustomization is what makes your online experience something special. This will remove your site’s version and generator information from all of your pages and feeds, making it a little bit harder for the bad guys and a little bit safer for you and your visitors. Here’s a function that does the job: // remove version info from head and feedsĪdd_filter('the_generator', 'complete_version_removal') ![]() This type of security technique is referred to as “security through obscurity,” and aims at hiding potentially sensitive data from a would-be attacker. Remove version number from pages and feedsĪ commonly cited security measure for WordPress-powered sites involves removing the automatically generated version number from appearing in the section of your pages’ source code. It will be included but commented out in the complete functions.php template file. Remember that if you use this combined function that you should remove or comment out both of the individual ones to avoid duplicate output. Note: if you happen to be adding the same content to your web pages (using the previous method) and your feeds (using this method), you may combine the two functions like so: // add custom content to feeds and postsĪdd_filter('the_excerpt_rss', 'add_custom_content') Īdd_filter('the_content', 'add_custom_content') Once in place, this will append a dynamic copyright message to each post in your feed. Yes, I know there are plugins that will make your feed footers do backflips, but for a simple copyright message or other info, I think it is easier and more efficient to simply toss a few lines into your custom functions.php template: // add custom feed contentĪdd_filter('the_excerpt_rss', 'add_feed_content') Īdd_filter('the_content', 'add_feed_content') Īs before, you can change the added content to whatever you want by editing the “ $content” variable. Just as with the previous method, this function makes it possible to automatically add any content to your feeds. By changing the line beginning with “ $content.”, you can add just about any content you like. The trick here is an old one, but it’s extremely useful. = 'This article is copyright © '.date('Y').' '.bloginfo('name').'' Īdd_filter('the_content', 'add_post_content') By including the following code in my functions.php template, it’s something that happens automatically: // add custom post content For example, at Perishable Press, I include a brief copyright statement at the end of each post. While there’s nothing wrong with inserting this content into your single.php template, it is sometimes easier to manage things from the functions.php file. If you look at the different things contained within a typical post, you will find many common and repetitive items, such as feed links, copyright information, and social-media bookmarks. ![]() To use, just copy and paste the template code at the end of this article or grab a copy of the zipped functions.php file and enjoy a custom collection of functions that will help you optimize your development process while enhancing WordPress with some awesome new functionality. In this DiW article, we extend our original functions.php template with 15 more useful functions.Īs before, we’ll first walk through each of the functions and then unify them into a working functions.php template. Not everything presented here is going to be necessary for all of your themes, so just grab what you need and add it your own custom functions.php file. These new functions extend the functionality of our original functions.php template with 15 more useful functions.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |