New website of the day at Awwwards.com: Ember House
Not everyone likes subversion. If you use Git to manage WordPress plugin development, keeping your Git repo and the WordPress.org SVN repo in sync is tedious. Luckily, we can use TravisCI deployment provider to automate SVN deployment after tests.
You need these before moving on:
- GitHub account
- TravisCI account
- Plugin source code
- WordPress.org plugin SVN repo (You get this after plugin review approval.)
First Push to GitHub
In order to use TravisCI, we have to host the plugin repository on GitHub.
First, create a new repository on GitHub by going to this page and filling in the repository name.
Then, we are going to commit all plugin files into Git and push it to this GitHub repository. Remember to replace the remote URL with yours.
$ cd /path/to/plugin/directory $ git init $ git add -A $ git commit -m "first commit" $ git remote add origin http://ift.tt/2tcXWMe $ git push -u origin master
Connect your GitHub repository with TravisCI by going to your TravisCI account page and switching on your repository. Click Sync account in the upper right corner if your newly created repository doesn’t show up in the list.
You’re all set. Every time you push new commits or someone makes pull requests to GitHub, it will trigger a build on TravisCI.
First Build on TravisCI
TravisCI uses a YAML file named
.travis.yml in the root of your repository to customize the builds. Learn more from the build customizing document to see how you can control the build lifecycle.
This is a basic configuration file that instructs TravisCI to run builds on PHP
7.1. Since testing is out of the scope of this tutorial, I replaced the actual test commands with
# .travis.yml language: php sudo: false php: - 7.0 - 7.1 script: # Run your tests here. - echo 'Tested'
Commit this file and push it to GitHub. TravisCI builds will be triggered automatically.
$ git add .travis.yml $ git ci -am "Add .travis.yml" $ git push origin master
Adding Deployment Provider Configuration
Deployment providers run if the tests passed and pre-defined conditionals (the
on section) are met. TravisCI provides nearly 40 official deployment providers. Sadly, none of them support WordPress.org subversion repositories. Thus, I made my own custom provider. You can find it on GitHub and its pull request.
To use it, add these lines to the end of
before_deploy: - mkdir build - cp LICENSE build - cp README.txt build - cp remove-medium-cross-links.php build deploy: - provider: wordpress-plugin edge: source: TypistTech/dpl branch: add-wordpress-plugin-deployment on: php: 7.1 tags: true repo: TangRufus/tutsplus-dpl-demo slug: remove-medium-cross-links username: tangrufus password: $WORDPRESS_ORG_PASSWORD build_dir: build
before_deploy section copies three files into the
build directory which is to be checked into the WordPress.org subversion repository. In the real world, this is where you want to run
grunt tasks to prepare the production-ready plugin.
Don’t copy test files or any unnecessary files into
build as the whole
build directory is released to users, and users don’t need your test files.
on section controls whether a deployment should be performed. Deployment is triggered only when all requirements are met.
In the above example, we deploy to WordPress.org only when:
- it’s a PHP
- it’s a tagged commit
- it’s triggered by the TangRufus/tutsplus-dpl-demo repo (forks and pull requests would not trigger deployment)
The plugin’s slug.
If your plugin’s URL is http://ift.tt/2tM1aTM, then
my-awesome-plugin is the plugin’s slug.
Your WordPress.org account username with which you submitted the plugin for review approval.
The password of the WordPress.org account. Never save this password in the
.travis.yml in plain text!
In the above example, we use the
$WORDPRESS_ORG_PASSWORD environment variable, which can be set on the TravisCI web dashboard. Choose Settings from the cog menu, and click on Add in the Environment Variables section. Never enable the „Display value in build log“ option!
Everything in this directory will be committed to the WordPress.org subversion repository, i.e. will be included in the downloadable zip file.
We set this to
build because we have copied plugin files into
Assume that we have fixed some bugs and are ready to publish a new version to WordPress.org.
These commands commit the changes to the
master branch but do not trigger a deployment:
$ git add -A $ git commit -am "Bug fix" $ git push origin master
Only tagged commits trigger deployment:
$ git tag -a 1.0.17 -m "Version bump 1.0.17" $ git push origin master --tags
Head back to TravisCI and open the PHP
7.1 build log. You should see a deployment is logged.
Building dpl gem locally with source TypistTech/dpl and branch add-wordpress-plugin-deployment Installing deploy dependencies !!! WordPress Plugin support is experimental !!! Preparing deploy Finding configuration for WordPress plugin deployment... Slug: remove-medium-cross-links Username: tangrufus Password found Build Directory: build Assets Directory: not found Validating configuration for WordPress plugin deployment... Configuration looks good Going to deloy tag: 1.0.17 Cleaning up git repository with `git stash --all`. If you need build artifacts for deployment, set `deploy.skip_cleanup: true`. See http://ift.tt/2cL3hlq. /usr/lib/git-core/git-stash: 186: /usr/lib/git-core/git-stash: cannot create /home/travis/build/TangRufus/tutsplus-dpl-demo/.git/logs/refs/stash: Directory nonexistent Deploying application Checking out http://ift.tt/2rTgqgq Clearing /tmp/d20170513-3291-1yh7vqo/trunk... Removing deleted files from subversion... D /tmp/d20170513-3291-1yh7vqo/trunk Temporary removing trunk and assets(if assets_dir is set) Deleting tmp/d20170513-3291-1yh7vqo/trunk Committed revision 1656616. Copying build to /tmp/d20170513-3291-1yh7vqo/trunk... Copying /tmp/d20170513-3291-1yh7vqo/trunk to /tmp/d20170513-3291-1yh7vqo/tags/1.0.17... Adding new files to subversion... A /tmp/d20170513-3291-1yh7vqo/trunk A /tmp/d20170513-3291-1yh7vqo/trunk/LICENSE A /tmp/d20170513-3291-1yh7vqo/trunk/README.txt A /tmp/d20170513-3291-1yh7vqo/trunk/remove-medium-cross-links.php A /tmp/d20170513-3291-1yh7vqo/tags/1.0.17 A /tmp/d20170513-3291-1yh7vqo/tags/1.0.17/LICENSE A /tmp/d20170513-3291-1yh7vqo/tags/1.0.17/README.txt A /tmp/d20170513-3291-1yh7vqo/tags/1.0.17/remove-medium-cross-links.php Committing 1.0.17 Adding tmp/d20170513-3291-1yh7vqo/tags/1.0.17 Adding tmp/d20170513-3291-1yh7vqo/tags/1.0.17/LICENSE Adding tmp/d20170513-3291-1yh7vqo/tags/1.0.17/README.txt Adding tmp/d20170513-3291-1yh7vqo/tags/1.0.17/remove-medium-cross-links.php Adding tmp/d20170513-3291-1yh7vqo/trunk Adding tmp/d20170513-3291-1yh7vqo/trunk/LICENSE Adding tmp/d20170513-3291-1yh7vqo/trunk/README.txt Adding tmp/d20170513-3291-1yh7vqo/trunk/remove-medium-cross-links.php Transmitting file data ...... Committed revision 1656617.
And on the WordPress.org trac (http://ift.tt/2tcjpEF<your-plugin-slug>):
svn commit Twice
Since TravisCI ships with an old version of
subversion which doesn’t play well with subdirectories, I do
svn commit twice.
svn commit removes everything inside
trunk. The second
svn commit copies everything from
edge doesn’t merge my branch into the upstream master. There is a chance that my branch is behind the official repo. When it happens, you can fork my branch and rebase it, and then change
.travis.yml to your GitHub repository.
To use this deployment provider:
- Host the plugin repository on GitHub.
- Connect GitHub and TravisCI.
- Add the configuration to
- Push a tag.
I hope all the above helps you deploy plugins to WordPress.org faster.
WordPress has an incredibly active economy. There are themes, plugins, libraries, and many other products that help you build out your site and project. The open-source nature of the platform also makes it a great option for you to improve your programming skills. Whatever the case, you can see everything we have available in the Envato Marketplace.
Thanks for reading!
from Envato Tuts+ Code – WordPress http://ift.tt/2u855tC
Creating your own WordPress theme is a great way to learn about the inner workings of the world’s most popular CMS. It also means that you can customize things to your liking, while utilizing only the scripts and styles that you need. When well-crafted, the result can be a theme that is both lightweight and functional.
If you’ve dabbled in editing themes (or, more safely, child themes) but want to take it up a notch, then this article is for you.
If you’re a complete beginner, you’ll also find information to help get you started. And, even if you’re a veteran at theme creation, it’s still a good idea to have some helpful resources at hand.
Why Create Your Own Themes?
While we discussed a few of the reasons above, let’s dive a little deeper into the topic. There are three key reasons why you’d want to create your own WordPress theme:
1. To Build it Your Way
Creating something that both looks and functions exactly the way you want is a big selling-point. Having to hack your way through someone else’s theme is a great learning experience, but can be tedious.
You also may run into some barriers when trying to make adjustments. After awhile, it just makes sense to build something that has what you need and leaves out what you don’t. It’s a great way to eliminate bloat and, since you wrote the code, it will also be much easier to maintain.
2. For a Great Starting Point
If you build websites for a living, you may want to use what is called a “starter” theme or theme framework. This is a simple, no frills theme that you can customize to your liking.
For example, a lot of developers (including yours truly) grab a copy of a package like Underscores and build something that they can reuse time and again. You’ll speed up your development process while providing a solid foundation for everything you build.
While this isn’t the same as building a theme from absolute scratch, you’re still taking a blank canvas and turning it into a fully-finished product.
3. For Distribution or Sales
Of course, there is quite a large market out there for free and commercial WordPress themes. Creating a theme others will use lets you share your vision of what a theme should be.
You might build a general purpose theme meant for a wide audience, or something that’s fine-tuned for a niche crowd. Either way, you can get great satisfaction (and maybe even make a living) seeing others utilize your creation.
Theme Development Resources
Now that we’ve looked at some of the benefits of building your own theme, let’s take a look at some resources you can use to help in the process. They run the gamut from code resources to plugins. Each has something unique to offer.
The official WordPress.org Theme Development documentation is a great place to start your journey. You’ll find information about the structure of a theme, coding standards and customization. It’s the most exhaustive resource and one you’ll keep coming back to.
You may also want to give the Theme Handbook a visit.
A template tag reference for WordPress 4.0+, you’ll find a nicely categorized list of each tag available to theme developers. Click on a tag to get a definition and an example code snippet.
Hasty is a free service that will help you easily generate custom code for your theme. You’ll be able to quickly generate code for menus, custom post types, sidebars, taxonomies and more. Both metabox and query generators are planned to launch in the near future.
Theme Check is a plugin written and used by folks with the WordPress Theme Review Team.
It will analyze your theme’s code to see if it’s using the latest WordPress standards. For reasons such as security and efficiency, standards do change as WordPress evolves. It’s a good idea to ensure that you aren’t using any outdated, or (gulp) insecure code.
This plugin will make you aware of any deprecated files or functions used in your WordPress theme. It was written by Andrew Nacin, who has been the lead developer on past versions of WP.
Did you know that jQuery is included with WordPress? It can be used to implement jQuery UI elements and more into your site. But there are some procedures to follow in order to fully take advantage of it. Daniel Pataki has written an easy-to-understand guide to help.
This beginner’s tutorial by Tania Rascia has all the basics covered. Even if you have no or very limited experience, you’ll get up and running rather quickly. This is Part one of a three-part series, with the others offering some more advanced tips and techniques.
functions.php file is where a lot of magic happens. You can add support for various features, create navigation menus, enqueue scripts and more.
The folks at WPBeginner have compiled a list of code snippets to help you make the most out of this powerful WordPress theme file.
Ensuring that your code is well-written is a big part of the overall success of your theme (whether it’s available to the public or not). A poorly-coded theme may not work as intended and can also be that much harder to maintain as time goes on. Damian Logghe provides some tips here to help steer you in the right direction.
Your Creation / Your Contribution / Your Way
Creating your own basic WordPress theme can be much simpler than you might imagine. Once you have an understanding of the basic components that make up a theme, it’s really not much more complicated than creating any other type of website.
WordPress, of course, also has its own set of features and tags that you need to be aware of.
While looking at the long list of possibilities may be a bit overwhelming, they are actually there to make your job easier. So much handy functionality has already been coded into WordPress – all it takes is a bit of research to learn how to utilize whichever parts you need.
Using the resources above, along with your own trial and error, will help you take advantage of all that a WordPress theme has to offer.
The post 10 Free Resources to Supercharge WordPress Theme Development appeared first on Speckyboy Design Magazine.
via Speckyboy Design Magazine http://ift.tt/2tLDNtu
New website of the day at Awwwards.com: Essential Products
New website of the day at Awwwards.com: Long Story Short