How do you code for WordPress?

In plain php and frameworks coding is done with the help of IDE tools, im using PhpStorm and very happy so far, recently i decided to discover most popular CMS this days and got confused how do you code for it?

1) do i have to deploy WordPress not only on my server, but locally too? edit files in IDE/editor and use WordPress “import/export” feature to sync my changes? how team of developers would work on this? what about VCS?

Read More

2) or i have to develop in dashboard? if so, there’s no highlight/auto-complete/intellisense and others benefits that drive your development futher.. and plugins for highlight i seen so far suck big time.

WordPress is path of a lone wolf?
Which general way WordPress developers follow?

Related posts

Leave a Reply

4 comments

  1. Judah’s way of developing for wordpress is definitely not wrong – simply different from the way I do things. Also, the two links he provided are very good. The blogpost appears worth a read and the codex is every wordpress developers bible.

    To offer you some more options to look into, this is my take on wp development:

    IDE / coding environment: If you wanted to alter say one element’s style, wp-admin (“the dashboard”) will suffice. For serious theme or plugin development however, it is definitely not an option.
    Hence you should stick to your IDE of choice. For the sake of completeness, being a *nix user, I’d use Komodo Edit on Linux and Coda on Mac. However, whether your handling wordpress, another CMS or are coding from scratch is irrelevant to your choice of IDE – use what you feel comfortable with. One of the most basic requirements I have for an IDE – and I’d recommend you to look out for as well – is it’s capability to load and save files to a server via ftp directly. It gets tedious to save your files locally and upload them with a second app. Another important criterion is decent syntax highlighting for php, css, js and html.

    Where to develop: After a bit of playing around you might come to the conclusion that you feel more comfortable developing locally – I don’t. I like to develop either directly on the server I will later go live on or on a server with the same setup (Apache and php versions, mySQL version to a lesser extent, last but not least: OS). Hence the importance of an IDE with integrated ftp capabilities. Should you choose to develop locally, make sure the environment is at least similar to the one you will later deploy the site on. For my way of doing things, I keep development subdomains on my server that are not accessible to the public. That way know the site will behave exactly the same way when I move it to go live.

    WordPress theme development: Starting completely from scratch, i.e. with a blank theme folder and creating every required file yourself, would be a very time consuming and for the wordpress novice near impossible mission. As a basis for writing your first wordpress theme I’d highly recommend downloading the Starkers theme developed by the iconic Elliot Jay Stocks. Starkers contains almost no styling and no semantic markup. It however comes with all the essential functions and files of a standard wordpress theme. Today I use my own bare-bone theme template, basically Starkers with a number of modifications that I’d otherwise do to it for every theme. That template serves me well because it is adjusted to my personal way of doing things (and stripped of comments), but what Elliot did is provide the perfect starting point for the (aspiring) theme designer.

    What else to do (if you go my path): Familiarize yourself with the basic structure of a wordpress theme. I wouldn’t go without a static header.php and footer.php that frame the site and inbetween of which all the magic happens. Know what best belongs in functions.php and why you should have one. Know what the wordpress loop is. Read the codex articles on Theme Development and The Loop. Read them again. When you understand a minimum 75% of their contents start dissecting Starkers, grasp its structure. Develop from there. Whenever you encounter a problem, check the codex (I do that mostly second hand – by googling the key terms followed by “wordpress”, often a page from the codex will be part of the first 5 results) first, then ask around.

    One last resource: Two years ago, I would have highly recommended watching Chris Coyier’s (of css-tricks.com) three-part instructional video on wordpress theming. Given that it is from early 2009, it utilizes wp 2.7 (the current version being 3.2.1). I’d still recommend checking it out, it’s a good an easy-to-follow screencast series with a lot of advice that still applies. Just watch it keeping in mind that some things have progressed since then. The first video of the series can be found here, the others by googling, searching the site or altering the URL, respectively.

  2. I guess that you could try developing through the dashboard but I think that it would be a little too difficult. Also, assuming that you wouldn’t the site to be live while you are building it you would still need to move it to a new directory after you finished development.

    Whenever I develop a theme from scratch I just start with the HTML/CSS for all the different pages and get those working locally. Then I do a local install of wordpress using MAMP or XAMPP and chop up my markup and turn it into a theme (chop it up into your different wordpress template files). Then you have some different options for getting the local version moved onto a remote server. I would usually do a fresh install of wordpress on the remote server, wipe out the default database and create a new one, replace the remote wp-content folder with my local wp-content folder (the one containing the theme I’ve just finished developing), do a sql dump of the local database and import it into the new database that I created on the remote server. Then hook your wordpress install up to your database through the wp-config file.

    Then you can continue to use your local copy of the site for bug fixes, continued development, etc and upload specific files to implement changes.

    You can follow this tutorial here to learn about actually creating the theme files: http://thethemefoundry.com/blog/html-wordpress

    You should definitely check out the Codex: http://codex.wordpress.org/ It’s kind of sprawling but the wordpress community is huge and the documentation is good.

  3. 1) do i have to deploy WordPress not only on my server, but locally
    too? edit files in IDE/editor and use WordPress “import/export”
    feature to sync my changes? how team of developers would work on this?
    what about VCS?

    The most common way a team of developers work on a WordPress project is using a version control system like SVN or Git. Using an IDE like PhpStorm check out a copy to your local machine making sure to set the WordPress root directory as your projects root directory.

    Work on the files and test on your local development environment then commit changes back to the master repository on the development or production server.

    It’s also very helpful to work with debugging on and configuring Xdebug in your IDE.

    In wp-config.php:

    define( 'WP_DEBUG', true);
    define('SCRIPT_DEBUG', true);
    define('CONCATENATE_SCRIPTS', false);
    define( 'SAVEQUERIES', true);
    

    2) or i have to develop in dashboard? if so, there’s no
    highlight/auto-complete/intellisense and others benefits that drive
    your development futher.. and plugins for highlight i seen so far suck
    big time.

    The dashboard editor is mainly just a convenience and should only be used for minor changes if at all. On a production server it should never be used and I like to disable it to prevent problems.

    WordPress is path of a lone wolf? Which general way WordPress
    developers follow?

    WordPress is very far from being on the path of a lone wolf. It is a large open source project with a huge community involvement. There are tons of resources available and many smaller communities you can participate in.

  4. I will get so much hate on this answer but I really think the OP needs to learn more PHP and WP before jumping into coding for WP. If he did, these questions would have never been asked.

    I’d rate him as a self-taught by online tutorials PHP pre-beginner that decided over-night to code WP and figured that a forum answer will teach him. It’s just not that easy…

    1. Know how WordPress works by actually using it and paying attention to details
    2. Read 1+ books on PHP/WordPress (I know it costs money, that’s how it works)
    3. Create local development environment (Setup server, domains, WordPress, etc)
    4. Use an IDE (NuSphere PhpEd on Windows) for quick function lookup as you best learn WordPress by staring at the core code
    5. Start small, learn how plugins/actions/filters work. When you know them you have mastered WP coding. Then you just have to know the actual functions and filters or how to find them when necessary (must have IDE)

    The kind of coding knowledge that comes for free is that kind of knowledge that makes your code a danger to yourself and everyone around you. Whoever told you knowledge is free was just eliminating a competitor.