WordPress

Dante Theme x TinyMCE issue

By | Wordpress | No Comments

I’ve been working on this project for a coulpe of weeks using the Dante theme and suddenly the page builder stopped working. I tried to activate it inside the post editing page and all I got was a message like Loading…, I checked the console and there was a TinyMCE warning and when i changed i received an error that it couldn’t save.

I then went to Google to try to find people having the same problem and all I found was a thread on their support but I couldn’t access because there was a problem with my client’s purchase code so we lost a couple of days trying to get access. Once we were in I found a few other threads and no solution from them. There was only one guy that found out the problem and I am sharing here because it would be easier to find and access.

You probably get this error because, like me, you entered text mode and then tried to activate page builder. You simply have to go to Visual Mode and then activate page builder!

Text Mode > Visual Mode > Page Builder

Not sure if this was related to a plugin, I saw some people saying it was ACF, but either way… Only activate Page Builder when in Visual Mode.

15 Things You Must Do When Changing WordPress Themes

By | Wordpress | No Comments

When you revisit some WordPress-driven sites, you may note a change in the feel or appearance of the site since your last visit. This change has been made by altering the WordPress theme of the site. The theme change may result in the disappearance of all your widgets. WordPress makes it very simple to change your blog’s theme design completely. Before you change the design, of your blog or site, you need to take some critical steps so that the change works smoothly.

The best thing about WordPress is that there are thousands of themes for customizing your blog. WordPress offers great flexibility. New themes are being created daily with many highly customizable free WordPress themes made available. The theme is actually just like a skin for the weblog. The overall look and presentation is also changed. The theme makes changes to the way you display the site but does not make changes to the basic software of the site.

Things You Must Do When Changing WordPress Themes

When you change themes, sometimes the new theme is not able to display the widgets well. This is not such a big problem in the case of standard widgets, such as Archives and Pages. But, you might have painstakingly created several customized scripts and hand written codes having hand-entered parameters. How can you prevent such a disaster from happening while changing your WordPress theme? You need to take care of some aspects while changing the theme to avoid this problem.

1. SAVING SIDEBAR CODES

Sometimes, the sidebar gets overwritten. Every so often, people make changes to the sidebars on WordPress by adding some text, links, and widgets. In cases using WordPress themes that are widget enabled, there is no problem regarding sidebars getting overwritten. However, in cases where you have made some manual changes, you may have to do them again. It is suggested you save the codes from the sidebar. You can do this by copying and pasting it safely somewhere. When switching the theme, you can edit sidebar files and then reapply the changes.

2. STAT TRACKING CODE

Many users make use of Google Analytics, common stat tracking tools which function with the help of code snippets in the footer or in the header. Annoyingly, when you change WordPress themes, both the header and the footer will get overwritten. Hence, you need to reapply the code snippets. If you forget to do this, the tracking of the site may not be done accurately and you will not be able to collect any data on visitors to your site. Check out whether the tracking tools are functional after switching themes.

3. CHECKING PLUGINS FOR DELETING

When changing themes, it is likely that you may not need all the plugins that you used for the previous theme. Some of the plugins might also not be suitable for the new theme and others might just be redundant. For instance, you might have used the optimal title plugin, which offers functionality of putting the title of the post in front of the name of the blog in the page title. This plugin is effective for increased SEO. But, suppose you change to a new theme that already offers this functionality, due to a changed code structure? You no longer need this plugin.

If you are making use of a plugin for making payments through the PayPal gateway, when you change themes, it is possible to completely eliminate this plugin. The new theme might already have PayPal integrated and does not require any plugin for making payments. Clean up all the plugins you don’t need and delete them.

Removing irrelevant plugins can also help in improving the security of your site. Removing these also helps the speed of downloading the pages of the blog.

4. WORKING OF THE PLUGINS

If you have not edited the template files, the plugin should work effectively. However, some plugins require making changes to the template file to work properly. For instance, the Related Entries plugin needs an addition of a code snippet, albeit small, in the WordPress file. In this case, it would be better to verify whether the plugin works. Again, it is also possible that some plugins display strangely in the new theme because of the changed CSS code found in the style sheet. You might have to make changes to the CSS as well.

If the plugins don’t work well in the new theme, you might also need to update the plugin. You can contact the author of the plugin. Alternatively, if you know a bit of CSS or HTML code, you can make changes to the plugin file.

5. CHANGES IN DESIGN AND COLOR OF ADS

Many blogs or sites run advertising, such as Google AdSense. They usually blend these ads to suit the color and design of the blog with its previous theme. When you make changes in the theme, you may have to make changes to the colors of the links. This means that the advertisements in their old color and design will not blend well with the new theme. If you are using AdSense Deluxe, it is fairly simple to make changes to the colors in WordPress. In the case of Text-Link-Ads too, you can make the changes with WordPress.

If you have been using a plugin for managing the ads, you need to replace the code of Adsense or other advertising networks manually in the new theme.

6. RSS FEED SUBSCRIPTIONS

Every blog owner knows the importance of RSS Feed Subscriptions. Make sure that it’s working after you switch themes. You could do this by yourself subscribing to the site. Subscribe using the FeedBurner link using just the URL of the blog alone. What should naturally happen is that the RSS reader should be able to find the feeds that are available. Make sure that it is pulling the right feeds. Though Google has shut down their Google Reader, there are other RSS aggregation services out there.

7. CHECK OUT SECONDARY FEATURES

It is important to check out all the features and see them in action. These include: searching, archives and also pages and categories. Sometimes, you might encounter some issues, due to a wrong format or some other problem. Sometimes, an excerpt from a post also could be missing. You’ll need to change this.

8. TESTING ON MULTIPLE BROWSERS

It is not enough to check the blog or site on a single browser. Make the test on multiple browsers. You will need to check it on Firefox, Internet Explorer, Chrome and Safari.

9. CARE IN MAKING MODIFICATIONS

Don’t make any sudden and radical changes to the WordPress theme. Take it slowly, one step at a time. Make minor adjustments and check them out before you test and see how they work. Try to optimize the blog when you change the theme. Replace any unwanted php codes and any other static URLs. This could be in the form of a homepage link or an RSS URL. Remove unnecessary JavaScripts and any other unused material.

You may also want to look into security loopholes. There are many WordPress theme designers who make use of codes in case of footer links, so that the users cannot remove the sponsor’s link. Sometimes, it is possible that some malicious script can also be encoded. It could be really disastrous for your site. Hence, ensure that there is no malicious code in your new theme.

In addition, if there are any unnecessary codes present in the header, you can remove these. Check out the listings of your pages. The display of the pages might differ in various themes. If you had excluded any page in the previous theme header, you will have to do the same thing with the new theme.

10. INFORMING USERS

After making changes to the theme, you might need to inform your users and visitors regarding the changes in the design of the blog. Ask them for their feedback. Different users have different types of setups, different browsers, screen sizes, and resolutions. They can give you an idea about any issues for correction at your end. Also, ask the RSS readers to check on the site and give you their feedback.

11. BACKUP FOR WIDGETS

You will have to manually create a backup for widgets. Go to the backend of WordPress and access the Widgets settings. It’s an old school method. Unfortunately, there’s no alternative quick fix. You will have to begin copying and pasting codes from every Widget. Paste them into a text document.

12. BACK UP EVERYTHING

Create a backup for everything on the blog: the posts, the pictures, and the database. Keep the backup on your hard drive. While making a backup, you need to have a complete database backup and a backup of all the folders on the site which are under the WordPress installation directory. You will also need to take a screen shot of plugins that are active and paste the codes of widgets in a text file. Paste header and footer scripts as well.

Have a backup for the Custom CSS, if you need to apply them to the new theme. These could be in the form of social bookmark styles and archives. You must make note of all critical wp-options. This will protect you against anything that might go wrong with the new theme. Note the values of fields, namely: the template, current theme, and the stylesheet. If the new theme fails to render the blog accurately, you can fall back on your old theme by restoring the above noted options.

13. CHECK OUT THE LINKS

It is crucial to note whether the links are working—especially, the About Me links and Contact links. These are very important for your blog. They are the major sources of contacting the author of the blog. There is a default About page in most themes. Ensure that you have linked to the right pages.

14. REMOVING UNWANTED LINKS/WIDGETS

If you have any unwanted links in the sidebar, remove them. If you have any unnecessary widgets as well, you can remove them from the side bar. It is also important to get rid of any footer links that are encrypted. You don’t need to be an expert programmer to do this.

15. RESEARCHING A NEW THEME

When selecting a new theme, select one that is appropriate. The new theme might not match the blog niche. Selecting a new theme can be quite tough at times. Bloggers are usually so enraptured with the features on the current theme that they want everything present in it and a lot more. Check out the XHTML compliance and whether it is validated. Run the demo of the theme URL in some validation service, such as W3C Markup Validation Service. If there are several validation errors, it would be better not to choose that theme.

Make a size check as well. Use the Save option in the browser and check out the size of the file. This should include the sub directories as well. It is suggested that you don’t pick a theme that is more than 150KB size in itself, without adding images, thumbnails, and ads. You may also want to look into the performance of the new theme before you install it.

One easy way of checking this out and seeing whether it loads quickly is to use some performance tools. You can get a rough idea for checking the site performance with the new theme. You will also have to verify other basic requirements, such as widget support and some after sales support.

Conclusion

WordPress is universally acknowledged as one of the best Content Management Systems (CMS). It is very simple to use. Even people with little technical background can use it. WordPress allows you to do amazing things with your site even if you have little knowledge of CSS or HTML. It is a popular platform for web developers and for bloggers as you can set up the site or blog in minutes by choosing and installing WordPress themes along with Plugins.

You don’t need a Webmaster for modification of the style or design of the blog. Yet, many developers ignore some basic steps while making changes to the design and style of the site with a new theme.

Sometimes, you might design the blog or site and might not be too happy with the results. You may get tired of the design and would like to change the WordPress theme. When you change the theme of the blog, you need to keep in mind that the changes you make should not in any way interfere with the functionalities of the blog.

You need to do some backup and other modifications when changing themes. Make sure that everything is functioning well. Apart from these tips, you may also need to become familiar with the new settings and the options provided, so that you don’t miss out on any important elements and features. Try keeping a change log to document the customization of the site. Develop the habit of taking screenshots of any changes you make to the site. This will make upgrading easier.

Take screenshots of the side bar and other customized settings in the blog before making theme changes. Other things to take care of while making modifications to your WordPress themes are Validation before you select a new theme.

It would also be a good idea to select a theme that is Widget Ready. You can select themes that are Widget ready by activating the theme and seeing whether there is a Widgets subpanel beside the Themes subpanel.

By following these steps, you can be assured of a smooth transition to the new theme for both yourself and your site visitors.

source: One Xtra Pixel

Why Dedicated WordPress Hosting Makes Good Sense

By | Wordpress | No Comments

There are so many options available to you when it comes to web hosting for your or your company’s site. Two of the most common and popular ones are shared and dedicated servers. A shared server hosts a number of different websites on one server, whereas a dedicated server hosts your site and no other. It’s all yours.

A shared server is cheaper, but that makes sense, since you’re sharing the cost (and resources, unfortunately) with other websites. And since you have no control over who your “neighbors” are, your site may end up sharing an IP address with unsavory sites that may end up dinging your business reputation.

A dedicated server, on the other hand, is all about you. You know who’s on the server, and there are no surprises. Granted, it costs more, but when it comes to hosting, you get what you pay for. So what are the advantages of dedicated WordPress hosting? Read on…

Variety


9 Leading Options for Managed WordPress Hosting

There is a plethora of dedicated WordPress hosting sites, ready to handle your personal or professional hosting needs. Among the more popular sites out there are: WPEngine, Page.ly, CloudyPress, KahunaHost, ZippyKid, BlueHost, JustHost, and HostGator. This list isn’t exhaustive; there’s more where that came from!

Data Safety


WordPress Security: How to Secure WordPress Thoroughly

When it comes to data worries, the two biggest are the data’s integrity and its vulnerability. In other words, backing up your files and keeping them safe from unauthorized access. Dedicated WordPress hosting sites, such as ManageWP, offer encryption and high security standards, as well as backup services. So, right of the bat, two of the biggest concerns get addressed with dedicated hosting. The peace of mind factor of this alone makes it worth the price of admission. And the beauty of this is, it’s not on your shoulders. You entrust these two crucial tasks to the professionals, after all you shouldn’t have to worry about how stuff like IPv6 security will affect your site, let them take care of you.

Ease Of Use


Essential WordPress Plugins to Kickstart Your Blog

Not everyone is a computer whiz or turbogeek. Many people favor the plug and play approach, and that’s totally reasonable; no one is here to judge! Dedicated hosting provides ease of upgrades, add-ons, and user interfaces, things which may make computer enthusiasts drool, but make the average site owner just stare blankly. Some hosting sites, such as Page.ly, offer automatic upgrades, pre-installed plug-ins, and rapid setup.

The dedicated hosts are also intimately familiar with WordPress and its inner workigns, so you get their expertise working for you. This means you derive maximum benefit from your host site.

Also, you have no fears of compatibility. Since your dedicated host works with WordPress, then you can be assured that WordPress runs smoothly on your system, with no nasty compatibility surprises.

SEO


Self-Hosted WordPress Websites: A Few SEO Do’s and Don’ts

Ah, Search Engine Optimization; the big buzzword for today’s e-commerce world. SEO is crucial for making sure your business’ site is turning up prominently in searches, which in turn means more page views, which hopefully translates into more sales. Some hosting sites offer SEO analysis and Google analytics, rather than you having to invest in separate SEO packages. There’s a lot to Search Engine Optimization, and entrusting it to a dedicated hosting site removes what can be a complex and baffling task.

Downsides


How To Resell Web Hosting

In all fairness, it’s only right to explore the disadvantages of dedicated WordPress hosting. It’s already been mentioned that dedicated hosting is more expensive, but that’s not all. Sites that offer dedicated WordPress hosting also means that it’s exclusively WordPress. If you ever want to try another content platform, you’re going to have to pull up roots and go to a different host.

Also, while your dedicated host is all great guns when it comes to WordPress support, if you’re experiencing issues with any other aspects of your site, you may be out of luck. Check how far your host’s support goes.

But At The End Of The Day..


The Only Web Hosting Guide You Will Ever Need – For Perfect Speed, Price, and Support

The advantages of dedicated WordPress hosting outweigh those few disadvantages. Look at it this way: if you want a gourmet meal, you can go out, buy all of the ingredients, read up on how to do it, and then go for it and hope for the best. Or, you can spend more money and go to a gourmet restaurant and have a professional take care of everything, including clean-up.

Bear in mind, different hosts offer different benefits. Shop around and find the one that offers you the best services for your needs and budget.

 

from: Andy Sowards

7 Deadly Sins of WordPress Development

By | Coding | No Comments

There’s a lot of freedom in WordPress development to extend the platform to just about anything you could imagine. However, when you develop for WordPress you have to make sure your theme or plugin can play nice with other WordPress extensions. Coding in a vacuum is inexcusable and can cause you or someone else a lot of trouble down the road. Here are some of the major things to look out for:

1. Loading your own copy of jQuery

picard

C’mon man…Seriously? Loading your own copy of jQuery is a great way to just ruin everything.

Novice plugin and theme developers sometimes make the mistake of loading their own copy of jQuery for whatever reason. In many cases they de-register the one that comes with WordPress, which looks something like this:

<?php
if( !is_admin()){
wp_deregister_script('jquery');
wp_register_script('jquery', ("http://cdn.jquerytools.org/1.1.2/jquery.tools.min.js"), false, '1.3.2');
//wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"), false, '1.7.2');
wp_enqueue_script('jquery');
}
?>

De-registering WordPress’ copy of jQuery and loading another has the potential to break all kinds of javascript in other themes and plugins.

The Solution? Don’t be THAT guy. Just use the copy included with WordPress.

2. Not loading JS/CSS files properly

This deadly sin includes two smaller sins. The first is adding inline script and stylesheet tags via your header file. Pasting them right into the header can cause them not to load at the right time and will also have them loading on every single page.

What’s the remedy? Use <a href=”http://codex.wordpress.org/Function_Reference/wp_register_script” target=”_blank”>wp_register_script</a>/<a href=”http://codex.wordpress.org/Function_Reference/wp_enqueue_script” target=”_blank”>wp_enqueue_script</a>.

Adding scripts the right way will load them on the right pages at the right time with the proper dependencies.

A second related deadly sin is loading custom Javascript and/or styles on every page, instead of conditionally loading it when necessary. Loading your script on every page is often not necessary. This can cause your site to slow down significantly.

The solution: Load your scripts only when necessary to keep your site lean and fast.

Here’s a very common example of how to do this, courtesy of Phil Banks’s tutorial on<a href=”http://customcreative.co.uk/conditionally-loading-plugin-scripts-in-wordpress/” target=”_blank”>conditionally loading plugin scripts in WordPress</a>.

add_action( 'wp_print_scripts', 'deregister_cf7_javascript', 15 );
function deregister_cf7_javascript() {
    if ( !is_page(15) ) {
        wp_deregister_script( 'contact-form-7' );
    }
}
add_action( 'wp_print_styles', 'deregister_cf7_styles', 15 );
function deregister_cf7_styles() {
    if ( !is_page(15) ) {
        wp_deregister_style( 'contact-form-7' );
    }
}

Essentially, this script stops the contact form script from loading on all pages and load only on the contact form page, using the page ID. It takes a bit of time, but you can use this same method to fine tune your WordPress site so that it’s not always loading unnecessary scripts.

3. Not escaping user input in SQL and not encoding user input on output

hacker-448x539SQL injection attacks are one of the most common ways to exploit web application vulnerabilities. Not escaping user input in SQL can leave you vulnerable to these kinds of attacks. This mostly pertains to plugin development but should also be a concern for regular WordPress users who may be installing a plugin from an untrustworthy source.

The solution: Make sure to sanitize user input in order to protect against SQL injection and then encode it on output for display to prevent XSS vulnerabilities. The WordPress codex has a section on Data Validation and WP Tuts has an excellent reference that goes into more detail:
Data Sanitization and Validation With WordPress.

4. Incorporating too many 3rd Party Services

social

The only place where a third party registration or login plugin makes sense is if a significant number of your user base, or potential user base, is active on that social network. The connection is then a convenience for your users and helps to get more people in the door. However, if you are offering the ability to register and log in via Twitter, FB, G+, and more just to cover your bases, then something is wrong. It’s simply not necessary and can actually bring your site to a crawl while loading all of those third party services.

The Answer: Include third party services sparingly and only if they are absolutely necessary.

5. Expecting too much from shared hosting

buffet-448x300

Shared hosting sucks. End of discussion. Don’t ever fall prey to the all-you-can-eat shared hosting buffets. You can actually waste a lot of your own time by expecting too much from shared hosting. When your server gets oversold and your site slows down, you can spend hours trying to sort this out with your host. It’s a mistake to think that you can add all kinds of media, plugins and social aspects to your WordPress site on a shared host and have it all running smoothly.

Recommendation: Purchase better hosting than you need, especially if you are expecting your site to grow. Cyber Monday is a great time to find excellent deals on VPS and dedicated servers. Take the time to do some research and you’ll be able to find an affordable host that can accommodate anything you want to do with WordPress.

6. Using “admin” for a username with an insecure password

Using “admin” for your administrator username and “password” for your password is a hacker’s dream come true. There are actually evil bots that go around looking for installations that have done this in order to exploit them.

The Solution: Give your site’s a unique admin user name and use a strong password. You can even add a plugin to force users to select strong passwords.

7. Adding tons of plugin-type functionality to a theme’s functions.php

stormtroopers-700x393

Why is this bad? There are a number of reasons that you want to avoid this as much as possible. For the sake or organization it’s best to keep your presentation separate from your functionality, especially if you have other developers working on the same site.

Also, it can be a nightmare to troubleshoot conflicts and problems after upgrades. For example, let’s say you’ve added a ton of functionality to your theme’s functions.php file but there’s no easy way to turn each part off one by one for determining the culprit when your site is having problems. If all of this functionality existed in separate plugins, you’d be able to more easily troubleshoot them and find the part that needs to be updated or removed.

Solution: Create a “functionality plugin” every time you are wanting to paste something into your functions.php file. It takes just a little more time but you’ll be grateful for it later.

Are these the deadliest WordPress development sins you know? What would you add to the list?

from: WPMU

Custom vs Pre-made WordPress Themes – A Look at the Pros & Cons

By | Coding | No Comments

So you’re launching a website with WordPress. Obviously, design and functionality are at the forefront of your mind. One of the first things you’ll need to decide is if your needs can be met by a pre-made theme with some customizations or if you need a fully custom theme developed just for you. There are certainly pros and cons to both, which is what I’ll be exploring in today’s post.

THE PROS OF A CUSTOM WORDPRESS THEME

There are two big pros to custom WordPress themes. The first is that you will be the only person and/or company online sporting that theme. With millions upon millions of blogs running WordPress, any pre-made theme is bound to be used by not just a few others – but many. So right out of the gate you have a big advantage in terms of setting yourself apart from the competition.

custom

The second big advantage of a custom WordPress theme is custom functionality. WordPress and the plugins that run on it are notorious for keeping certain powerful elements (such as custom post type templates) just out of reach for the average user to fully leverage. But with a custom theme you can have your developer(s) come up with all of the custom elements you’ll need to succeed in your specific niche.

THE PROS OF A PRE-MADE WORDPRESS THEME

There are also two very big pros to pre-made WordPress themes. The first is affordability. While some themes may be more expensive than others, they typically stay under $100. There is no custom option available for those kinds of prices. So if you can find a pre-made theme that meets all of your needs, you stand to save a lot of money.

premade

The second big pro for pre-made WordPress themes is future-proofing. Granted, not every pre-made WordPress theme is made equal. Not by a long shot. But the best ones all come with regular updates, good support and a large/active community that can help with customizations, troubleshooting, etc. If you have someone create a custom theme for you, it’s very likely you’ll be on your own after it’s delivered.

THE CONS OF A CUSTOM WORDPRESS THEME

Obviously, the biggest con for someone considering a custom WordPress theme is cost. It’s not going to cost you hundreds of dollars (or Pounds, Euros, etc.), but thousands. So depending on your size and budget this could be an immediate deal breaker for many. That said though, it’s important to invest in your online presence. These days it can make or break you. So anything you spend on making your website an attractive and effective part of your business is a good investment.

The only other thing I would make sure to look into before deciding on a custom theme is whether or not future updates, bugs, etc. are going to be addressed by the developer. If they are not then you’ll have to find another developer or online WordPress Maintenance Service that can jump in where they leave off.

THE CONS OF A PRE-MADE WORDPRESS THEME

To a large extent, the downsides of choosing a pre-made theme depend on who you buy from. Is their code clean? Do they follow the recommended WordPress development best practices? Such as separating out core functionality from theme design. What’s their support like? Do they have an active community forum for everyday troubleshooting? How often do they update? And so on.

The answers to these questions will be crucial to picking the right author or shop to buy your pre-made WordPress theme from. Only after these questions are answered correctly will you be able to look at the basics like price point, theme design and features.

Assuming you get all of that right, the one con that will always follow you no matter which pre-made theme you choose is limited customizability. Especially if you’re buying a theme because you’re unable to get what you want out of a theme you can create or customize on your own. For the most part, you’ll have to stay within the boundaries set up by that theme author and customize only the basics like theme colors, fonts and images.

FINAL THOUGHTS

I always like to close posts like this with an assurance that there is no right answer that covers all cases. As I mentioned during the post, your website is extremely important and a good deal of thought should go into how it is created and what purposes it will serve. So whatever you decide (pre-made or custom) you’ll want to take as many factors into account as possible before making your final choice.

My personal preference and what I recommend to my friends and clients, is to find a WordPress theme framework capable of doing what you want. If there is an existing child theme for that framework that suits your needs then you’re set. If not (and you’d like some other custom elements) then hire a developer that specializes in working with that framework.

Ideally you’ll get the best of both worlds: a solid framework from a reputable WordPress development shop that has great support, updatability, community, etc. and you’ll also get the custom elements you’re after too. In this way it might be possible to keep costs down to a minimum while still getting the custom look and functionality you’re after.

What are your thoughts on custom vs pre-made WordPress themes? Tell us all about it in the comments below!

from: WP Lift

Want a custom theme? Contact me!

14 key WordPress functions to jump-start theme development

By | Coding | No Comments

After a few years (or even months) of designing and developing WordPress themes, especially for clients, you start to realize that a lot of the functionality can be standardized or distilled down into a “starter theme or kit”. These wordpress functions helps get the development process started and moving along apace.

There are about 13 key functions that I like to start out with and will add to them as needed…

1. Custom menu support

The navigation menu feature, introduced in WordPress 3.0, allows for the intuitive creation and maintaining of navigation menus in themes.

At the very least, a standard theme will need a main navigation menu, perhaps in the header and a secondary navigation menu in the footer. To do this, we will register those two menus “Main Menu” and “Secondary Menu”

While this isn’t a particularly new feature, its still nice to wrap it in an if function_exists() just in case the user is stuck in a pre 3.0 installation:

In the functions.php file, include the following:

if ( function_exists( 'register_nav_menus' ) ) {
	register_nav_menus(
		array(
		  'main_menu' => __( 'Main Menu', 'cake' ),
		  'secondary_menu' => __( 'Secondary Menu', 'cake' ),
		)
	);
}

Now that the Menus are registered, we need to tell the theme where to output them. We’d like the Main Menu to appear in our header. So, in our header.php file, we include the following code:

<?php if ( has_nav_menu( 'main_menu' ) ) { ?>
	<?php $defaults = array(
	  'theme_location'  => 'main_menu',
	  'menu'            => '',
	  'container'       => false,
	  'echo'            => true,
	  'fallback_cb'     => false,
	  'items_wrap'      => '<ul id="%1$s"> %3$s</ul>',
	  'depth'           => 0 );
	  wp_nav_menu( $defaults );
	?>
<?php } else { ?>
	<ul>
	  <?php wp_list_pages('title_li='); ?>
	</ul>
<?php } ?>

First, we check to see if we have a menu called ‘main_menu’ defined and if we do, we insert its contents here, otherwise we fallback to the default wp_list_pages() which we can further customize to display the links as we need.

If you’d like even further customization of the menu, see the WordPress codex page on wp_nav_menu() function.

We want the secondary menu to appear in the footer, so we open up the footer.php and include the following code:

<?php if ( has_nav_menu( 'secondary_menu' ) ) { ?>
	<?php $defaults = array(
	  'theme_location'  => 'secondary_menu',
	  'menu'            => '',
	  'container'       => false,
	  'echo'            => true,
	  'fallback_cb'     => false,
	  'items_wrap'      => '<ul id="%1$s"> %3$s</ul>',
	  'depth'           => 0 );
	  wp_nav_menu( $defaults );
	?>
<?php } else { ?>
	<ul>
	  <?php wp_list_pages('title_li='); ?>
	</ul>
<?php } ?>

2. Style the visual editor

This function allows you to use custom CSS to style the WordPress TinyMCE visual editor.

Create a CSS file named editor-style.css and paste your styles inside. As a placeholder, I like to start with styles in the editor-style.css file of the Twenty Twelve theme.

In the functions.php add the following:

add_editor_style();

If you don’t want to use the name “editor-style” for your CSS file and also want to move the file elsewhere, e.g. in within a css directory, then modify the function.

For example, I want to name my file tiny-mce-styles.css and I want it within my CSS directory; so my function will look like this:

add_editor_style('/css/editor-style.css');

While we’re at it, we might as well style the editor for right-to-left languages. In the theme directory, create a CSS file called editor-style-rtl.css and, at the very least, include the following:

html .mceContentBody {
	direction: rtl;
	unicode-bidi: embed;
}
li {
	margin: 0 24px 0 0;
	margin: 0 1.714285714rem 0 0;
}
dl {
	margin: 0 24px;
	margin: 0 1.714285714rem;
}
tr th {
	text-align: right;
}
td {
	padding: 6px 0 6px 10px;
	text-align: right;
}
.wp-caption {
	text-align: right;
}

Again, as a placeholder, the above styles are from the Twenty Twelve theme. Restyle and extend as needed.

3. Custom avatar support

Most people commenting on blogs online have an avatar associated with them. If, however, they don’t and you don’t particularly like the WordPress default avatar options, you can define your own.

To do so, include the following code in your functions.php:

if ( !function_exists('cake_addgravatar') ) {
	function cake_addgravatar( $avatar_defaults ) {
		$myavatar = get_template_directory_uri() . '/images/avatar.png';
		$avatar_defaults[$myavatar] = 'avatar';
		return $avatar_defaults;
	}
	add_filter( 'avatar_defaults', 'cake_addgravatar' );
}

What we’re doing here first, is checking to see if the function exists. If it does, we add a filter that tells WordPress to use our custom defined avatar as the default.

We are telling WordPress to find this avatar in our “images” directory inside the theme directory. Next step, obviously, is to create the image itself and upload it to the “images” folder.

4. Post formats

The post formats feature allows you to customize the style and presentation of posts. As of this writing, there are 9 standardized post formats that users can choose from: aside, gallery, link, image, quote, status, video, audio, and chat. In addition to these, the default “Standard” post format indicates that no post format is specified for the particular post.

To add this functionality to your theme, include the following code in yourfunctions.php, specifying the post formats you’ll be taking advantage of. e.g. If you only want the aside, image, link, quote, and status Post Formats, your code should look like this:

add_theme_support( 'post-formats', array( 'aside', 'image', 'link', 'quote', 'status' ) );

5. Featured image function

The featured image function, as the codex explains, allows the author to choose a representative image for Posts, Pages or Custom Post Types.

To enable this functionality, include the following code in your functions.php:

add_theme_support( 'post-thumbnails' );

We could stop there and leave it up to WordPress to define the thumbnail sizes or we could take control and define them ourselves. We’ll do the latter, obviously!

Let’s say we’re running a magazine site where the featured image will appear in at least 3 different sizes. Maybe one large image if the post is featured or is the newest, a medium sized image if its just a post among the rest and a regular size perhaps to appear elsewhere.

We take advantage of the add_image_size() function that instructs WordPress to make a copy of our featured image in our defined sizes.

To do this, we add the following to the functions.php:

// regular size
add_image_size( 'regular', 400, 350, true );

// medium size
add_image_size( 'medium', 650, 500, true );

// large thumbnails
add_image_size( 'large', 960, '' );

See how to work with the add_image_size() function to either soft crop or hard crop your images on the WordPress codex page.

6. Attachment display settings

Once we’ve defined the above image sizes (regular, medium and large) — and since by default WordPress doesn’t do it for us — we’ll add the ability to select our those image sizes from the Attachment Display Settings interface.

It would be nice if you could, when writing a post, insert the desired size image by selecting it from the dropdown as you normally would for the WordPress default sizes.

To do this, we add the following to our functions.php:

// show custom image sizes on when inserting media
function cake_show_image_sizes($sizes) {
    $sizes['regular'] = __( 'Our Regular Size', 'cake' );
    $sizes['medium'] = __( 'Our Medium Size', 'cake' );
    $sizes['large'] = __( 'Our Large Size', 'cake' );
    return $sizes;
}
add_filter('image_size_names_choose', 'cake_show_image_sizes');

With that in place, we can select our image sizes.

7. Add feed links (instead of old RSS code in head)

This one is simple. If you’ve been building WordPress themes for a while, you’ll remember the days when you had to manually include code to output the RSS feed right in the header.php. This approach is cleaner and relies on the wp_head() action hook to output the necessary code.

In the functions.php file, include the following:

// Adds RSS feed links to for posts and comments.
add_theme_support( 'automatic-feed-links' );

Make sure that you have it in the header.php, right before end of 

8. Load text domain

With this function you take the first step towards making your theme available for translation.

Its best to call this function from within the after_setup_theme() action hook i.e. after the setup, registration, and initialization actions of your theme have run.

add_action('after_setup_theme', 'my_theme_setup');
function my_theme_setup(){
    load_theme_textdomain('my_theme', get_template_directory() . '/languages');
}

Now add a directory named ‘languages‘ in your theme directory.

You can learn more about load_theme_textdomain() function on the WordPress codex page.

9. Define content width

Content width is a feature in themes that allows you to set the maximum allowed width for videos, images, and other oEmbed content in a theme.

That means, when you paste that YouTube URL in the editor and WordPress automatically displays the actual video on the front end, that video will not exceed the width you set using the $content_width variable.

if ( ! isset( $content_width ) )
	$content_width = 600;

WordPress also recommends the addition of the following CSS:

.size-auto,
.size-full,
.size-large,
.size-medium,
.size-thumbnail {
	max-width: 100%;
	height: auto;
}

While this is useful, its a bit heavy handed. It defines the content width for all content. What if you wanted videos of a larger width on pages than in posts and an even larger size in a custom post type? Currently, there is no way to define this. There is however a feature request proposing the inclusion of the $content_width variable into the built-inadd_theme_support().

10. Dynamic sidebar

Your typical theme will have at least one sidebar. The code to define the sidebar is pretty straightforward.

Add the following to your functions.php:

if(function_exists('register_sidebar')){
	register_sidebar(array(
		'name' => 'Main Sidebar',
		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
		'after_widget' => '</aside>',
		'before_title' => '<h3>',
		'after_title' => '</h3>',
	));
}

This registers and defines a sidebar named “Main Sidebar” and its HTML markup.

You can learn more about the register_sidebar() function on the WordPress codex page.

You’ll routinely find the need to have more than that one sidebar so you can just copy/paste the above code and change the name.

There is also a register_sidebars() function that will allow you to register and define multiple sidebars all at once but it doesn’t give you the flexibility of giving each new sidebar a unique name.

11. Custom “more” link format

If you’re displaying excerpts of your posts on a blog index page, by default WordPress will show […] to indicate there’s more “after the jump”.

You will most likely want to add a “more link” and define how that looks.

To do this we need to add the following code to our functions.php:

function new_excerpt_more($more) {
       global $post;
	return '...<br /><br /><a href="'. get_permalink($post->ID) . '" class="read_more">read more →</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');

This adds an ellipses ‘‘ right after the excerpt and includes a read more link after two break tags. You can rename and style the read_more CSS class for the link as desired.

12. Basic pagination

Each theme might have different pagination needs but it’s always safest to start with a nice default functions: previous_posts_link() and next_posts_link().

function cake_content_nav( $nav_id ) {
	global $wp_query;

	if ( $wp_query->max_num_pages > 1 ) : ?>
		<nav id="<?php echo $nav_id; ?>" class="content_nav clearfix">
			<ul>
				<li class="nextPost"><?php previous_posts_link( __( '← newer ', 'cake' ) ); ?></li>
				<li class="prevPost"><?php next_posts_link( __( 'older →', 'cake' ) ); ?></li>
			</ul>
		</nav>
	<?php endif;
}?>

13. Redirect after theme activation

If you have special instructions in your theme eg. in your theme options page that you’d like the user to see when they first activate the theme, you can use the following function to redirect them there:

if (is_admin() && isset($_GET['activated']) && $pagenow == "themes.php")
	wp_redirect('themes.php?page=themeoptions');

Pay special attention to the wp_redirect() function. Make sure to replace the ‘themes.php?page=themeoptions‘ with the URL of your page.

14. Hide admin bar (during development)

During development, I sometimes find the WordPress admin (tool) bar to be quite distracting.

It’s in a fixed position at the top of the window and depending on my layout can cover some elements of the header.

While still designing and developing, I like to hide the admin bar with this handy function.

show_admin_bar( false );

from: Webdesigner Depot