Improve The Deployment Of WordPress Websites

To Improve The Deployment Of WordPress Websites As WordPress matures into a full-fledged CMS and more and morelarge online publishers come to rely on the platform, the practice of developing and deploying websites becomes increasingly important. High-profile members of the WordPress community, such as core developer Mark Jaquith and Cristi Burca, have spoken on the topic and built tools such as WP-CLI and WP Stack to improve the professionalism of our administration and deployment.

But what I’m really interested in is the current state of WordPress deployment: how an average developer manages the deployment of their websites, and how can we improve as a community?

In late July 2012, I conducted a short survey to help me answer these questions. The survey was open for three months and drew a modest but not insignificant 327 respondents. This article documents the results of the survey and draws some conclusions about where education is needed and how we can help each other become more professional when deploying our WordPress websites.

The Demographic

In my survey, I asked a few questions to establish the demographic that’s working with WordPress; this was obviously already done in far greater detail with the WordPress user and developer survey, but I felt that getting a sense of who was responding to this survey was important. Of the 327 respondents, 43% self-identified as developers, 10% as designers, 40% as both designers and developers and 7% other.

The vast majority were located in the North America (50%) and Europe (38%), with the following continents also registering: Asia (6%), Australia (4%), Africa (3%) and South America (1%). I also asked respondents how they would categorize the businesses they work for. Here’s how they responded:

biz-type

The results were overwhelmingly in favor of freelancing (46%), with small businesses (19%) and small agencies (17%) taking a close second and third place, respectively. These figures back up accepted knowledge that WordPress is largely used by small internal Web teams, regional Web agencies and freelancers. Finally, as with the WordPress user and developer survey, I asked respondents whether they made their living from WordPress. This was relatively evenly split, with a small majority of 59% saying yes.

That said, of those who identified themselves as developers, 67% said they earn their living from WordPress, which suggests that WordPress developers are generally more inclined to stick with one platform than designers, who are perhaps more agonistic.

Deployment Practices

Now we get to the meat of the survey, how respondents actually deploy their WordPress websites. Combined, the 327 respondents maintain 6,378.5 WordPress websites — yes, someone maintains half a WordPress website. The majority of respondents manage a fairly small number of websites, with 46% looking after fewer than 10. That said, an impressive 8% manage between 30 and 40 websites, and, incredibly, one person is responsible for 700. Below is a breakdown of the numbers.

WEBSITES MAINTAINED BY SURVEY RESPONDENTS

Number of websites Number of respondents
Fewer than 10 149
10 – 20 109
20 – 30 26
50 – 100 7
100 – 200 4
200 – 500 1
500 – 1000 1

VERSION CONTROL

I asked all respondents whether they use version control and, if so, which software they favor. Astonishingly (at least to me), 45% of respondents said they do not use version-control software at all as part of their workflow. Of the remaining 55%, Git was by far the most popular, taking 41% of the vote, and Subversion surprisingly accounted for only 9%. Drilling down a little deeper, 28% of those who identify themselves as a developer stated that they do not use version control, and 48% of those who are both developers and designers said the same. Here’s a breakdown of overall responses on version-control software:

version-control

Next, I asked respondents what method of deploying websites they favor. These I broke down into FTP, SFTP, SCP, SSH + version control, SSH + version control + Capistrano, and other. Again, somewhat shocking for me was to find that FTP took 49% of the vote, followed by SFTP (20%) and SSH + version control (17%). My preferred method, SSH + version control + Capistrano, got only 3% of the vote; but even with so low a number, I was pretty encouraged to hear that people out there take the time to work in this manner.

ENVIRONMENTS

I asked respondents whether they maintain different environments for their WordPress websites — that is, whether they set up local, test, staging and live environments. Answering yes didn’t require that they run all of these environments, but simply that they differentiate between the website they develop on, the website on which they show changes to a client and the live website. The vast majority of respondents (75%) indeed do this, which is great news.

An important facet and constant pain point of running multiple environments is the need to alter URLs in the WordPress database when migrating the database from one environment to another. I asked respondents how they typically deal with this problem and gave them an open field to type their answer. Here are some answers that came up repeatedly. These aren’t actual responses, but rather my representation of groups of similar replies.

“I don’t migrate between staging and live databases.”

“I don’t touch the database. I just export and import posts out of and into WordPress.”

“I use Dave Coveney’s PHP script for finding and replacing URLs in the database, including those in serialized data.”

“I do a find-and-replace on the SQL dump and the website’s files.”

“It’s a massive pain in the arse, and I steer clear of it.”

“I dunno. What is the best practice on this?”

COWBOY CODING

Finally, to gauge how strictly people adhere to general best practices, I asked respondents whether they ever cheekily edit code on the live server. Let’s be honest: this question is only ever going to yield one outcome. As expected, a whopping 76% owned up to having tweaked some WordPress production code in their time.

What We’ve Learned

In reviewing the lessons learned, it’s important to say up front that I am not criticizing the development and deployment practices of the survey’s respondents. The goal was to identify the areas where we, as a community, can become more professional and to draw some conclusions on how we might achieve that. You’ll find no finger-wagging or hyper-critical feedback for developers — just broad conclusions drawn from the responses.

VERSION CONTROL

First, clearly not enough of us are using version control in our everyday workflow. This is a fundamental tool for any developer, and for 61% of those who self-identify as a developer or as both a designer and developer to say that they don’t use version control indicates that effort is needed in the WordPress community to educate developers on the importance of source-control management.

Still, while not enough WordPress developers use version control, that so many who do use Git is very positive. I prefer the decentralized approach of Git, and while WordPress’ core team still uses (and will likely continue to use) Subversion, Git brings many benefits. Suppose a few teams are working on a project. Each team could write to its own repository, and then a senior member of the quality-assurance team or an administrator could merge changes from all of those repositories into a protected repository before deploying the website. This approach makes a lot of sense if the website you’re working on is large and members of your team are dispersed, and it’s why I favor Git.

ENVIRONMENTS

While a lot has been done to grapple with the issues arising from WordPress storing URLs in the database, the problem goes beyond WordPress’ core and extends to plugins and even to the pesky URLs ending up in serialized data. This is a pain in the arse at best, and a complete time-suck at worst. There are many options for overcoming this, but the most common choice is either not to migrate data from environment to environment at all or to use Dave Coveney’s PHP script. Both have their problems. For me, the first just isn’t viable, and the second, while perfectly acceptable, isn’t automated enough and is pretty time-consuming. There has to be a better option.

Free and premium tools and plugins offer solutions to this problem. One that came up a lot in the survey’s results was BackupBuddy and its migration feature. I’ve played around with its functionality, and, while it works perfectly well, it does not (as yet) work with Multisite, and I actually found the process more arduous than using a find-and-replace script. One project of mine that has emerged from this survey is to automate the find-and-replace process with a tool for Capistrano.

from :http://www.smashingmagazine.com/2013/04/15/wordpress-deployment-survey/

[quote font=”verdana” font_size=”14″ font_style=”italic” color=”#474747″ bgcolor=”#F5F5F5″ bcolor=”#dd9933″ arrow=”yes” align=”centre”]This Demo Content Brought to you by Momizat Team [/quote]

this is tags and keywords : wordpress themes momizat Tutorial wordpress templates

The Options For WordPress Theme Development

At the recent WordCamp Edinburgh, I took part in a panel discussion about WordPress theme development and the options available to developers when building themes. The overriding conclusion from the session was that there isn’t a one-size-fits-all answer and that the best method depends on the needs of the website and the capabilities of the developer.

But if you’re starting out building WordPress themes or want to develop a system for building them more efficiently or robustly, how do you decide which approach to take? In this article, we’ll briefly describe how WordPress themes work and then look at some of the different approaches to developing them, with tips on which approach might be most suitable for your website and circumstances.

How Does A WordPress Theme Work?

In WordPress, themes drive a website and determine what it contains, how it behaves and what it looks like. The theme is separate from the content, which is held in the database. This means you can use the same theme on more than one website, regardless of the content of the websites — which you might already be doing if you’ve downloaded themes from WordPress’ theme repository.

 

What To Consider When Developing A WordPress Theme?

Before deciding which approach to take to develop your theme, identify your constraints. These likely include the following:

  • Time
    How much time do you have to develop your theme, or to learn how to do it?
  • Budget
    This is related to time but also has to do with whether you can afford to pay for a premium theme or a theme framework.
  • Capability
    How familiar are you with theme development, with CSS and PHP and with how themes work? If you’re not familiar, how much do you want to learn?
  • Future-proofing
    Will your theme need to be updated in future? Will other developers be working on it in addition to you? If so, then your approach will need to be as robust as possible.
  • Repetition
    Do you see yourself developing a number of similar themes in future? If so, your approach will have to allow for code to be reused.

We’ll revisit these considerations at the end of the article and identify which development options are most suitable for various situations.

Theme Development: Your Options

A few options are available for developing your theme or themes, and investigating them before you roll your sleeves up and start coding would be worthwhile. Picking the right approach will result in a better theme, with more robust code, and it will minimize the amount of revisions you’ll have to do later. It will also help you to build the theme more efficiently.

The options we’ll look at here are:

  • Build a theme from scratch,
  • Edit (or “hack,” some might say) an existing theme,
  • Use the theme customizer to tweak an existing theme,
  • Create a child theme to make changes to an existing theme,
  • Create your own parent theme (using one of the approaches above) and child themes,
  • Use a theme framework.

1. BUILD A THEME FROM SCRATCH

This approach is the most difficult if you’re inexperienced. But if you’re a seasoned WordPress developer, it will give you the most control. It might be the most appropriate method if you’re importing HTML from an existing static website that is being upgraded to WordPress with no other changes.

However, when transferring a website to WordPress, conducting a review of it as part of the process, rather than simply copying the code across, is a good idea. If you are copying a static website, you’ll need to keep a close eye on your code to ensure that it’s clean, efficient and valid.

2. EDIT (OR HACK) AN EXISTING THEME

This is how most people start with WordPress theme development: in working on a theme that they’ve downloaded, they see that some styling isn’t quite right, so they delve into the style sheet and make some edits. Starting like this is tempting because it feels like a quick and easy way to achieve the effect you want. But there are some dangers:

  • If you ever switch themes, that update will override any changes you’ve made.
  • It’s easy to add repetitive code by adding new styles lower down in the style sheet that override styles higher up, rather than removing what you don’t need.
  • The website could end up with a lot more code than it needs.
  • If the theme isn’t well coded or commented to begin with, you could get yourself into a bigger mess and find that you have to make a lot of fixes.

However, hacking a theme can work if you go into it with your eyes open. It may be an option if the following are true:

  • The theme you’re using is well written, valid and commented (e.g., the default WP theme, Twenty Eleven);
  • The changes you’re making are so drastic that you wouldn’t need to update the original theme;
  • You understand the PHP and CSS contained in the theme and are comfortable editing, adding to and removing it without breaking the theme.

If you do decide to go down this route, keeping a backup of the original theme and commenting your code thoroughly are important. I would also advise commenting out any code that you don’t want and then testing to see what happens before deleting anything.

3. USE THE THEME CUSTOMIZER TO TWEAK AN EXISTING THEME

The theme customizer was released with WordPress 3.4. It gives you the option to customize a theme without writing any code, simply by using a WYSIWYG interface. Depending on how well the customizer is written into the theme itself, you can use it to change images, titles, colors and even the layout. Expect to see more themes with the customizer integrated into them.

Using the WordPress theme customizer with the Twenty Ten theme.
Using the WordPress theme customizer with the Twenty Ten theme.

The theme customizer stores your changes in a separate file, not in the theme’s style sheet, so there will be repetitive code.

For more information, take a look at Otto on WordPress’ video tutorial or guide to integrating the theme customizer into your own themes.

4. CREATE A CHILD THEME TO MAKE CHANGES TO AN EXISTING THEME

This approach is similar to editing an existing theme, but safer. It consists of creating a brand new theme that is defined as a child of the existing theme. Where your child theme doesn’t have a particular file but the parent theme does, it will use that. Where the child theme does have a file, that file will override the equivalent in the parent. This line tells the browser to load the parent theme’s style sheet before rendering any of the styles in the current style sheet. This frees you from having to duplicate any styles in the parent theme that you want to use.

So, that’s how child themes work. But when is this the best approach? I would suggest using it in the following cases:

  • You already have a theme (to be used as the parent) that contains most of what you need for your theme;
  • You want to be able to update your parent theme (for example, when theme updates are released following a WordPress update);
  • You don’t want to get tied up in knots from hacking an existing theme;
  • You want the option to revert to the parent theme or to develop another similar theme in future (which would be a new child theme);
  • You’re developing a number of similar websites with some minor stylistic or content differences (I did this when building similar websites for a client that owned multiple companies);
  • The difference between your child and parent themes is not so huge that you need to start from scratch, or not so huge that your child theme’s code will override anything affected by updates to the parent theme.

 

from : http://www.smashingmagazine.com/2013/03/13/a-guide-to-wordpress-theme-options/

[quote font=”verdana” font_size=”14″ font_style=”italic” color=”#474747″ bgcolor=”#F5F5F5″ bcolor=”#dd9933″ arrow=”yes” align=”centre”]This Demo Content Brought to you by Momizat Team [/quote]

this is tags and keywords : wordpress themes momizat Tutorial wordpress templates

Improve WordPress Theme Development Process

There is so much to learn about WordPress theme development. The Internet is home to hundreds of articles about building WordPress themes, to countless theme frameworks that will help you get started, and to endless WordPress themes, some of which are beautiful and professional but not a few of which are (to be honest) a bit crappy.

Rather than write another article on building a WordPress theme (which would be silly, really, since any theme I build would fall into the “crappy” category), I’ve asked some of the top theme designers and developers to share some tips and techniques to help you improve and refine your theme development and design process.

Before we get into that, Mark Forrester, cofounder of WooThemes, has shared some insight into his firm’s development process. Given WooThemes’ success, no doubt we can all learn something from it.

A Peek Into Woo

Whether you work in a large theme shop or are a lone designer, you can learn plentyfrom another designer or developer’s workflow.

  1. A theme at WooThemes starts life on the ideas board, through specifications provided by the community or based on a concept that’s emerged from customer research. It is designed either in house or by an industry-leading designer who is hired on contract.
  2. The theme is then meticulously designed in Photoshop. All of the major elements are styled and the pages constructed before any code is touched. Mark recommends Photoshop Etiquette for guidelines on structuring your design file. He says, “The better the Photoshop file, the easier the theme build.”
  3. Once the design is approved, it’s assigned to a developer, who works from WooThemes’ base theme. This includes the templates that come with every WooTheme, along with basic styling. The base theme has a responsive layout, and the CSS is managed using LESS, which Mark strongly recommends.
  4. Theme development is managed with Trello, and milestones are set withTeamGantt.
  5. Once the theme is finalized, the developer creates a demo for the website that is populated with dummy content and that tests almost every element of the design.
  6. The team sets about beta testing the theme. A list of bugs, tweaks and solutions is compiled, a hackathon is scheduled, and everything is completed by the developer.
  7. For WooThemes’ own redesign (which is awesome — congrats, guys!), the team started to use BugHerd, which helped them gather user feedback and track it directly in the pages.
  8. All revisions are included in the change log for easy reference. A strict numbering convention distinguishes between bug fixes and new features.

That’s a lot of process right there. Creating a WooTheme theme is about much more than knocking out a few lines of code. Here’s what Mark has to say:

“When we create and edit our themes it is not simply diving into the code. We have to carefully consider our community of users and how any code might impact their usage, and the template files’ customization ability.”

Apart from workflow, what else can be learned from professional theme designers and developers?

Develop Locally

If you’re not developing locally, then now’s the time to start. Here’s what Chris Coyier has to say about it:

“Designers and developers who work mostly on WordPress sites are, in my experience, the worst offenders of the “just do it live” development system. FTP commandos, if you will. I know — I was one for a lot of years. I suspect it’s the case because there are quite a few requirements to run a WordPress site locally: an Apache server running PHP and a MySQL database.

These things aren’t preinstalled on most computers like they are on most servers. Even if you get over those hurdles, setting up a workflow between local and live isn’t trivial.”

Luckily for you, Chris is going to show you a better way. Developing locally is easy to get started with.

STEP 2: GET OFF FTP

Developing locally has so many benefits. In particular, you’ll be able to do the following:

  • Have a record of everything that has ever changed and when it changed.
  • Roll back mistakes.
  • Become more efficient by using text-editor features such as “Find in Project.”
  • Work on major redesigns without worrying about screwing up a live website.

ALTERNATIVE TOOLS FOR A LOCAL SERVER

Use Live Reload

When you’re developing a theme, switching to the browser and reloading the page gets old pretty fast. That’s why Drew Strojny, founder of The Theme Foundry and the guy behind WordPress’ gorgeous new Twenty Twelve default theme, uses LiveReload:

“LiveReload is a great little application that works through a browser extension. LiveReload automatically reloads your page when a file has been changed in your project.

This is a huge productivity boon when you’re editing and tweaking a WordPress theme. All those small page refreshes add up to a big chunk of time saved at the end of the day. Not to mention, your fingers get a much needed break!”

The Theme Foundry loves LiveReload so much that it’s built support for it into Forge, its free command-line toolkit for bootstrapping and developing WordPress themes.

Use Git

Git is a distributed version-control system that is popular among developers all over the world. The great thing about Git is that you can quickly create a branch, make changes within that branch and then test those changes without affecting the master version. It’s what The Theme Foundry uses for every project:

“Quite honestly, we’d be lost without it. Git makes branching cheap and easy. You can experiment quickly with different ideas without worrying about getting lost. Think of it like the trail of pebbles left by Hansel and Gretel to help them find their way back home.

Git gives you the power to leave nicely annotated pebbles along your development path. If you see something interesting and wander off the trail, but then later change your mind, you can always get back to where you started.”

LEARNING GIT

 

from : http://www.smashingmagazine.com/2013/02/21/wp-theme-development-process/

[quote font=”verdana” font_size=”14″ font_style=”italic” color=”#474747″ bgcolor=”#F5F5F5″ bcolor=”#dd9933″ arrow=”yes” align=”centre”]This Demo Content Brought to you by Momizat Team [/quote]

this is tags and keywords : wordpress themes momizat Tutorial wordpress templates

Child Themes for WP Framework

The theme framework you’ve built will be used as a parent theme in the sites you develop. This means that in each case you’ll need to create a child theme to create a unique site with its own design and with extra or different functions compared to the framework.

The obvious way to go about this is to dive in and start creating template files in your child theme to override those in the framework, but thanks to the action and filter hooks you’ve added to your framework, this might not always be the best approach.

In this article, I’ll outline some of the techniques you can use in your child themes to make best use of your framework and improvise your workflow.

The topics I’ll cover are as follows:

Creating starter child themes
Amending code via the framework’s filter hooks
Adding code via the framework’s action hooks
Creating template files in your child theme
When to use a plugin instead
Creating Starter Child Themes framework

The main purpose of developing your theme framework is to adopt the DRY (Don’t Repeat Yourself) principle, and that applies to your child themes, too.

It can make you more efficient if you create one or more ‘starter’ child themes for use with your framework, which contain the core code you need to get started on new projects.

When deciding how to go about doing this, consider the way you work and the sites you build:

Do you create a lot of sites for clients in the same sector with similar needs?
Do you want to offer low cost template based sites to smaller clients?
Are there specific template files you tend to create for most of your new projects?
Is there functionality you need to include on some sites but not others? (For example, I use two starter child themes, one with comment functionality and one without.)
Is there styling you tend to use for most projects, or can you use object oriented styling or a CSS preprocessor for most projects?
Are there libraries or resources you use for most new projects, or for a significant proportion of them?
Do you have two or three main categories you can place projects under, with each category involving similar development work?
If you’ve answered yes to any of these questions, then developing one or more starter child themes may save you time. You can create a set of child themes with the basic code that you repeat across all projects using them, and then you don’t need to rewrite that code (or create those files) for each new project.

Note on caveat: If you’re adding some code to every single new project, you may want to add it to your framework instead of to child themes, maybe by using a hook so you can override it if a different need arises in the future.

Even if you answered no to the questions above, it’s worth creating a very basic starter theme with an empty stylesheet and functions file, and adding the instructions WordPress needs to access your framework’s parent theme .

You might also want to create a starter functions.php file with the functions you most frequently use in your child themes. You can then choose to remove any of these and/or add to them for specific projects.

Amending Code via Filter Hooks

As well as adding styling to your child theme, you’ll most likely want to make changes to the code output by the framework. The most lightweight way of doing this is via filter hooks, so it’s worth exploring those first to identify if you can use any of them.

Creating a function which you then attach to a filter hook is much more efficient than creating a whole new template file for the new code; however, if you find yourself doing this repeatedly with the same filter hook, you might want to consider changing that filter hook to an action hook and writing a new function for each project which you activate via that action hook.

To be more efficient, you might want to create a set of relevant functions which you place in the functions file of different start themes or even create a plugin with your function which you activate when needed. I’ll cover plugins in more detail later in this series.

Adding Code via Action Hooks

Your theme framework will also have action hooks which you can use to insert content in various places in your sites.

If you’ve been working on the code files for the framework bundled with this tutorial series, you’ll have seven action hooks to work with:

before the header
inside the header
before the content
after the content
in the sidebar
in the footer
after the footer.
To do this, create a functions.php file in your child theme and .

There is plenty of other content you could add using your action hooks, such as sharing buttons above or below the content, extra content in the footer, a search box in the header and much more.

You might just want to add some content on specific page types, such as single blog posts, in which case the most obvious place to start would be by creating a newsingle.php template. But you can still use your action hooks with the addition of a conditional tag.

Creating New Template Files

On occasion you won’t be able to do what you want using the filter or action hooks in your framework, in which case you’ll need to create new template files in your child themes.

These might be the same template files as are stored in your framework, in which case the files in the child theme will override them. Or they might be new template files, for example for a new category, taxonomy or post type.

If you are creating template files in your child themes, it makes things easier if you use the template files in your framework as a starting point. The steps I follow are:

Identify the template file you need to create with reference to the WordPress template hierarchy
Create a blank file with the appropriate name in your child theme
Identify the file in your framework which is closest to the new file (again with reference to the template hierarchy)
Copy the contents of that into your new file
Make amendments to the new file as required.
Doing this saves you the work of duplicating any code which will be common between your new file and the existing files in your framework, such as the calls to include files.

When to Use a Plugin Instead

Another option you have when creating sites based on your framework is to use plugins in conjunction with your child themes. A plugin won’t replace a child theme completely, but it can be useful in the following circumstances:

The functionality you want to add isn’t theme-dependent (i.e. you want to keep it if the site ever changes theme in future). This might include registering custom post types or taxonomies, for example.
You want to use this functionality on a number of the sites you create, but not enough for it to go into a starter child theme or the framework itself.
I’ll cover developing plugins for your framework in the next part of this series.

Summary

Your theme framework is just the starting point of a library of code and files you’ll create to support the sites you develop. Each site you create will need to run on a child theme, which will have your framework theme as its parent.

As we’ve seen, your child themes will add their own styling and functionality, and they can do this by hooking into the action and filter hooks in your framework, or via the creation of new template files. It’s always a good idea to adopt the solution which needs the least code, as that makes your site faster and your life easier!

from :http://code.tutsplus.com/tutorials/creating-child-themes-for-your-wordpress-theme-framework–cms-21933

[quote font=”verdana” font_size=”14″ font_style=”italic” color=”#474747″ bgcolor=”#F5F5F5″ bcolor=”#dd9933″ arrow=”yes” align=”centre”]This Demo Content Brought to you by Momizat Team [/quote]

this is tags and keywords : wordpress themes momizat Tutorial wordpress templates