Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Wordpress Workflow

Wordpress Workflow

Welaika Wordpress Workflow. Our Approach.

Filippo Gangi Dino

July 01, 2013
Tweet

More Decks by Filippo Gangi Dino

Other Decks in Programming

Transcript

  1. 3 WordPress? WordPress is a free and open source blogging

    tool and a CMS based on PHP and MySQL which runs on a Web hosting service. Features include a plug-in architecture and a template system. WordPress is used by over 14.7% of Alexa Internet's "top 1 million" websites and as of August 2011 manages 22% of all new websites. WordPress is currently the most popular blogging system in use on the Web, powering over 60 million websites worldwide. It was first released on May 27, 2003. http://en.wikipedia.org/wiki/WordPress
  2. 6 WordPress? 1. World's most used CMS 2. 10 years

    of development and very active community 3. Easy for customers and developers 4. Fast development 5. SEO friendly Pros
  3. 7 WordPress? 6. Rich documentation 7. Powerful backend 8. Extensible

    functionality: plugins 9. Frontend highly customizable 10. Open Source Pros
  4. 8 WordPress? 1. World's most used CMS 2. Maintenance 3.

    Hard-set model (data) 4. Poor growth capacity 5. Limits in pages customization Cons
  5. 9 WordPress? 6. Frequently updates (plugins damage!) 7. Plugins confilcts

    8. Migration and deploy 9. Low performance with lots of content 10. PHP syntax jungle Cons
  6. 25 Dev Environment sudo service apache status php --version sudo

    service mysql status type rvm | head -n 1 which git User in ww-data or nogroup? (id > sudo usermod -a -G www-data username) Check
  7. 27 Dev Environment 1. Manage multiple Ruby Versions 2. Isolated

    from system. User-level use 3. Different gemsets. Specific Ruby Version and specific gemset for every project RVM - Ruby Version Manager
  8. 28 Dev Environment What is a gem? A RubyGem is

    a software package, commonly called a “gem”. Gems contain a packaged Ruby application or library. The RubyGems software itself allows you to easily download, install, and manipulate gems on your system. Commands: list, install, update, uninstall RubyGem
  9. 30 Dev Environment $ rvm install 2.0 $ rvm use

    2.0@wordless --create --default && gem install therubyracer sprockets compass coffee-script thor yui-compressor && rvm wrapper 2.0@wordless wordless compass ruby visit site RVM + Gemset for Wordless
  10. 41 Wordless 2. The ability to create a new theme

    skeleton directly within the WordPress backend interface
  11. 42 Wordless 3. The ability to write PHP code using

    the beautiful Haml templating system
  12. 43 Wordless 4. The ability to write CSS stylesheets using

    the awesome Sass syntax and the Compass framework
  13. 46 Wordless 7. A growing set of handy and documented

    helper functions ready to be used within your views (helpers! helpers!helpers!)
  14. 47 Wordless The RVM Way $ rvm install 2.0 ##

    Use Ruby 2.0 $ rvm use 2.0@wordless --create --default && gem install therubyracer sprockets compass coffee-script thor yui-compressor && rvm wrapper 2.0@wordless wordless compass ruby ## Create Wordless gemset
  15. 50 Wordless Wordless Theme anatomy 1. A structured, organized and

    clean theme organization (taken directly from Rails)
  16. 51 Wordless The index.php serves as a router to all

    the theme views if (is_front_page()) { render_view("static/homepage)"); } else if (is_post_type_archive("portfolio_work")) { render_view("portfolio/index"); } else if (is_post_type("portfolio_work")) { render_view("portfolio/show"); } 1. A structured, organized and clean theme organization (taken directly from Rails)
  17. 52 Wordless Layouts (theme/views/layouts directory) Just like Rails, when Wordless

    renders a view as a response, it does so by combining the view with a layout. Within a layout, you have access to the yield() helper to combine it with the main content 1. A structured, organized and clean theme organization (taken directly from Rails)
  18. 53 Wordless Initializers (config/initializers/*.php files) Remember the freaky functions.php file,

    the one where you would drop every bit of code external to the theme views (custom post types, taxonomies, wordpress filters, hooks, you name it). That was just terrible, isn't it? Well, forget it. Wordless let you split your code into many modular initializer files, each one with a specific target 1. A structured, organized and clean theme organization (taken directly from Rails)
  19. 54 Wordless Initializers config/initializers ├──backend.php ├──custom_post_types.php ├──default_hooks.php ├──hooks.php ├──login_template.php ├──menus.php

    ├──shortcodes.php ├──thumbnail_sizes.php └── wordless_preferences.php 1. A structured, organized and clean theme organization (taken directly from Rails)
  20. 55 Wordless Backend interface – new theme 2. The ability

    to create a new theme skeleton directly within the WordPress backend interface
  21. 56 Wordless Backend interface – preferences 2. The ability to

    create a new theme skeleton directly within the WordPress backend interface
  22. 57 Wordless HAML Beautiful, DRY, well-indented, clear markup: templating haiku.

    http://haml.info/ 3. The ability to write PHP code using the beautiful Haml templating system
  23. 58 Wordless HAML (pHAMLp) 3. The ability to write PHP

    code using the beautiful Haml templating system HTML + PHP <div class="content"> <p> <img src="/images/logo.jpg" alt="Logo" /> Markup should be beautiful. </p> <ul class="list"> <?php for($i=0; $i<3; $i++) { ?> <li><?php echo $i; ?></li> <?php } ?> </ul> </div> HAML .content %p %img{:src => "/images/logo.jpg", :alt => "Logo"} Markup should be beautiful. %ul.list - for($i=0; $i<3; $i++) %li= $i
  24. 59 Wordless SASS Beautiful, DRY, well-indented, clear markup: templating haiku.

    http://sass-lang.com/ 4. The ability to write CSS stylesheets using the awesome Sass syntax and the Compass framework
  25. 60 Wordless SASS Variables SASS $blue: #3bbfce $margin: 16px .content-navigation

    border-color: $blue color: darken($blue, 9%) .border padding: $margin / 2 border-color: $blue 4. The ability to write CSS stylesheets using the awesome Sass syntax and the Compass framework CSS .content-navigation { border-color: #3bbfce; color: #2b9eab;} .border { padding: 8px; border-color: #3bbfce;}
  26. 61 Wordless SASS Nesting SASS table.hl margin: 2em 0 td.ln

    text-align: right li font: family: serif weight: bold size: 1.2em 4. The ability to write CSS stylesheets using the awesome Sass syntax and the Compass framework CSS table.hl { margin: 2em 0;} table.hl td.ln { text-align: right;} li { font-family: serif; font-weight: bold; font-size: 1.2em;}
  27. 62 Wordless SASS Mixins SASS @mixin table-base th font-weight: bold

    @mixin left($dist) margin-left: $dist #data +left(10px) +table-base 4. The ability to write CSS stylesheets using the awesome Sass syntax and the Compass framework CSS #data { margin-left: 10px; } #data th { font-weight: bold; }
  28. 63 Wordless SASS Selector Inheritance SASS .error border: 1px #f00

    .error.intrusion font-size: 1.3em .badError @extend .error border-width: 3px 4. The ability to write CSS stylesheets using the awesome Sass syntax and the Compass framework CSS .error, .badError { border: 1px #f00;} .error.intrusion, .badError.intrusion { font-size: 1.3em;} .badError { border-width: 3px;}
  29. 64 Wordless Coffeescript CoffeeScript is a little language that compiles

    into JavaScript. Underneath that awkward Java-esque patina, JavaScript has always had a gorgeous heart. CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way. http://coffeescript.org/ 5. The ability to write Javascript logic in Coffeescript
  30. 65 Wordless Coffeescript 5. The ability to write Javascript logic

    in Coffeescript Coffeescript # Assignment: number = 42 opposite = true # Conditions: number = -42 if opposite # Functions: square = (x) -> x * x # Arrays: list = [1, 2, 3, 4, 5] # Objects: math = root: Math.sqrt square: square cube: (x) -> x * square x # Existence: alert "I knew it!" if elvis? Javascript var cubes, list, math, num, number, opposite, race, square, __slice = [].slice; number = 42; opposite = true; if (opposite) { number = -42;} square = function(x) { return x * x;}; list = [1, 2, 3, 4, 5]; math = { root: Math.sqrt, square: square, cube: function(x) { return x * square(x); }}; if (typeof elvis !== "undefined" && elvis ! == null) { alert("I knew it!");}
  31. 66 Wordless gem The CLI way for Wordless Tasks: wordless

    clean # Clean static assets wordless compile # Compile static assets wordless deploy # Deploy your WordPress site using the deploy_command defined in your Wordfile wordless help [TASK] # Describe available tasks or one specific task wordless install # Install the Wordless plugin into an existing WordPress installation wordless new [NAME] # Download WordPress in specified directory, install the Wordless plugin and create a Wordless theme wordless theme [NAME] # Create a new Wordless theme NAME github.com/welaika/wordless_gem
  32. 67 Wordmove Wordmove is a nice little gem that lets

    you automatically mirror local Wordpress installations and DB data back and forth from your local development machine to the remote staging server. SSH and FTP connections are both supported. Think of it like Capistrano for Wordpress, complete with push/pull capabilities. github.com/welaika/wordmove
  33. 68 Wordmove Tasks: wordmove help [TASK] # Describe available tasks

    or one specific task wordmove init # Generates a brand new Movefile wordmove pull # Pulls WP data from remote host to the local machine wordmove push # Pushes WP data from local machine to remote host Options: -w, [--wordpress] -u, [--uploads] -t, [--themes] -p, [--plugins] -l, [--languages] -d, [--db] -v, [--verbose] -s, [--simulate] -e, [--environment=ENVIRONMENT] [--no-adapt] [--all]
  34. 69 Wordless Extender (experimental) Wordless Extender (WlE from now on)

    is a starting point for every Wordlress theme we develop at weLaika. After years of hard work we have starred a few plugins, best practices and security enhacements. WlE is a collection of those and let you control all this so cool things within the WordPress backend, in a fast and familiar way. github.com/welaika/wordless-extender
  35. 70 Wordless Extender (experimental) Plugin Manager Never change a winning

    team! These are our starred and often used plugins; with these we cover the 90% of our developing needs. You'll have a control panel inside WlE to list, enable, disable and upgrade plugins from the collection; never search that useful plugin crawling the WP.org repo and have colleagues kickstart projects with always the same plugin set, making the teamwork easier and more coherent over the time.
  36. 71 Wordless Extender (experimental) wp-config.php Constants Manager Manage WP constants

    (stored in your wp-config.php) directly within the WP backend! We got inspired by WordPress guidelines and we crafted this little control panel. It is intended for advanced users: we are not interested in making things easy, with fluffy names or other strategies, but we'd like to remember important/complex/abstruse settings and have them always just one click away Everytime you'll update these configs wp-config.php file will be backed-up in wp-config-backup.php. Keep it safe in mind.
  37. 72 Wordless Extender (experimental) Security fixes This is the most

    important section in our hearts: improving WP security. Most of the tricks are directly from Hardening Wordpress guide; others are paranoid tricks discovered on battlefield. Keep in mind that you have to know what you are doing; follow the comments in the panel below if you are confused. Remind that when you'll let the plugin rewrite your .htaccess file, it will take a backup copy of the last version in htaccess_backup. If you are asking about what exoteric things are we doing with your .htaccess, well, go read the template in resources/htaccess. Essentially we'll block access to varius files and locations which is better if locked down (strange query strings, access to txt files in core/theme/plugins, markdown files, wp debug error log, ecc). We are always at work to improve this section, so if you have some tips open us an issue or send us a pull request.
  38. 73 Wordless Extender (experimental) Wordless integration WlE menu in the

    WP backend, will be integrated with the Wordless new (will be in the next tagged release 0.4) custom backend menu, creating one place to control them all! Wordless has (and will have moar!) helpers dedicated to the WlE's plugin collection. Let contribute to the helpers too, if interested!
  39. 76 Long Running Frequently core updates > RTFC(changelog) Frequency and

    reliability of plugins updates > No! Is fundamental a strict selection of plugins to be included in project Manage Wordpress sites from a central admin panel (for massive updates) > infinitewp.com Updates
  40. 77 Long Running Why a off-site backup? - more secure

    - advanced backup systems without limits by inside Wordpress backups - avaible datas for out production tasks (e.g. Security scan) Backup. Or GTFO
  41. 78 Long Running - If the backup is in the

    same WordPress folder on the same webserver and the site is compromised, the backup itself is compromised - If the WP installation has problems, the backup is not affected Off-site BKP – More secure
  42. 79 Long Running - Incremental backups - Does not affect

    the web server performances (storage, CPU usage, etc...) Off-site BKP – Advanced
  43. 80 Long Running - If WebServer is down, we have

    datas avaible - Datas avaibles for strong tasks, in indipendent systems and right resources (like passive security) Off-site BKP – Availability
  44. 81 Long Running rdiff-backup wrapper + db backup incrementale retention

    Multihost github.com/welaika/weBackup weBackup
  45. 82 Long Running Maldet - www.rfxn.com/projects/linux-malware-detect/ Linux Malware Detect (LMD)

    is a malware scanner for Linux released under the GNU GPLv2 license, that is designed around the threats faced in shared hosted environments. It uses threat data from network edge intrusion detection systems to extract malware that is actively being used in attacks and generates signatures for detection. In addition, threat data is also derived from user submissions with the LMD checkout feature and from malware community resources. lfbg.pl - github.com/pioneerskies/lfbg.pl This little script's scope is to act as regex collection in order to do code scanning about maliciuos code and files. Passive Security