
WordPress latest release is just around the corner. This time it’s going to be big, some cool features are in the box. Time to patch up your WordPress theme. Here is all you need.
What’s new in WordPress?
See all the new features in WordPress here or if you are in a hurry.
I tried out the Beta1 release, its impressive! Try it out (at your risk, take backups, take backups, take backups). To accommodate all the new features, your theme needs to undergo some changes. Get the most of WordPress with the following tweaks.
If you enjoy the post, don’t forget to share it or bookmark it. Thanks.
Enable Navigation Menu Editor for Easy Menu Management
Many users are gonna love this feature. If the theme supports this, users will be able to manage the navigation menu from Dashboard, right under the Appearance settings. There will be a new item Menus.
To enable this, add the following to the functions.php of your theme:
add_theme_support( 'nav-menus' );
To call the menu into the theme, add the following to the header.php:
<?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_class' => 'menu-header' ) ); ?>
where menu-order is the css class for the menu. You will have to change this according to your style-sheet.
Source:
For more details – How to Add Custom Navigation Menus in WordPress Themes.
Enable Custom Header Management to Change Header Images Easily
define( 'HEADER_IMAGE', '%s/images/logo.png' ); // The default logo located in themes folder define( 'HEADER_IMAGE_WIDTH', apply_filters( '', 770 ) ); // Width of Logo define( 'HEADER_IMAGE_HEIGHT', apply_filters( '', 153 ) ); // Height of Logo define( 'NO_HEADER_TEXT', true ); add_custom_image_header( '', 'admin_header_style' ); // This Enables the Appearance > Header // Following Code is for Styling the Admin Side if ( ! function_exists( 'admin_header_style' ) ) : function admin_header_style() { ?> <style type="text/css"> #headimg { height: <?php echo HEADER_IMAGE_HEIGHT; ?>px; width: <?php echo HEADER_IMAGE_WIDTH; ?>px; } #headimg h1, #headimg #desc { display: none; } </style> <?php } endif;
Use the Following hook in header.php
to link to the header image:
<?php header_image(); ?>
Example:
<img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="Header Image" />
Automatically Add Feed Links into Your Theme
No longer do you need to add those multiple feed links to your theme header. Add this to your functions.php and the job is pretty much done.
add_theme_support( 'automatic-feed-links' );
Add Support For Post Thumbnail Images
This feature was originally out with WordPress 2.9, thought I would include it here, in case someone missed.
Many Magazine style and Newspaper style WordPress themes uses a Thumbnail image on the homepage. Older themes used custom fields to get this done. Starting with latest WordPress lets you upload an image and set it as the post thumbnail, only if the theme supports it.
To enable this, add the following to the functions.php of your theme:
add_theme_support( 'post-thumbnails' );
The image uploaded as Featured Image can be called using:
<?php the_post_thumbnail(); ?>
Once you enable this, you can set the Featured Image or the Thumbnail image for the post using a widget (that will then appear) in the post editor right sidebar, below categories and post tags.
Enable Custom Backgrounds for your Theme
Just add the following code to functions.php and under Appearance you will see a new item: Background.
add_custom_background();
Now you can change the theme background (by changing it’s color or uploading a background image or both) within WordPress admin, without having to touch a single line of code. Cool, huh?
Useful Code Snippets
Here is a collection of 8 useful code snippets that would come handy once you install WordPress. There are many hidden features which cannot be accessed via the Dashboard. So make sure you read them all.
- How to create a custom post type
- Custom post types with custom taxonomies
- Query custom post types
- Enable multi site feature
- Custom author profiles
- Add custom backgrounds
- Style WordPress editor using CSS
- Make your theme compatible with WordPress menus