• Stars
    star
    110
  • Rank 316,770 (Top 7 %)
  • Language
    PHP
  • License
    MIT License
  • Created almost 13 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Tools for WordPress projects

Tools for WordPress

This is a box of tools for working with WordPress on the command line, automating WordPress, and Fabric scripts for automated deployment.

One-liner to setup a new project using these tools:

bash -c "$(curl -fsSL https://raw.github.com/newsapps/wp-project-tools/master/setup.sh)"

Project layout

We moved everything out of the WordPress directory so that we could make ample use of git submodules. Plugins, themes and uploads are now outside of the WordPress directory.

data/       # Store configuration for the site, data dumps and data files for doing migrations
lib/        # Place to put extra php libraries
uploads/    # Wordpress uploads for a single blog or the root blog in a network
blogs.dir/  # Uploads for network blogs
plugins/    # Put your wordpress plugins here
tools/      # This repository
http/       # Place for your apache, nginx, http server config files
mu-plugins/ # Put your wordpress mu plugins here
themes/     # Put your wordpress themes here
wordpress/  # The WordPress codebase
wp-scripts/ # Place for putting command-line scripts that do WordPressy things
manage.sh   # Do fun stuff from the command line
fabfile.py  # Fabric automated deployment config

manage.sh

The management script does a few simple things.

  • manage.sh runserver Starts an http server for local development
  • manage.sh setup_env Install the required python packages for using all of these tools
  • manage.sh shell Starts an interactive WordPress shell. Evaluate php, test WordPress queries, etc.
  • manage.sh script_name script_arg This will look for a php script in wp-scripts/ or tools/wp-scripts with the name script_name.php and run it with the arguments provided. You can create your own scripts and place them in wp-scripts/. See below for how to write your own scripts.

Setup the development server

These are the instructions for setting up the development server on Mac OS X using Homebrew. If you are not on Mac OS X or using Homebrew, look up the instructions for how to install nginx, php-fpm, memcached, and the memcache-php extension for your setup.

Use brew to install the following packages:

$ brew install nginx memcached memcache-php

Get the php recipe:

$ brew install https://raw.github.com/adamv/homebrew-alt/master/duplicates/php.rb --with-mysql --with-fpm

Enable the memcache extension:

$ mate /usr/local/etc/php.ini

add

extension="/usr/local/Cellar/memcache-php/2.2.6/memcache.so"

to the extension section.

Make sure the new php and nginx is on your path:

$ export PATH=/usr/local/sbin:/usr/local/bin:$PATH

Use the manage script to start the server:

$ ./manage.sh runserver

This script will load the nginx config file http/development-nginx.conf.

Logging will be outputted to the terminal session

Writing management scripts

Management scripts are easy!

These are simple php scripts that perform a simple task in WordPress (updating settings, migrating data) which can be run from the command line.

Just add this line to the top of your php script:

include( 'tools/cli-load.php' );

This include will bootstrap WordPress for you. It does roughly the same thing as wp-load.php or wp-blog-header.php, but is safe to use from the command line.

This include also creates a $settings global. This settings variable is an associative array that is loaded with the contents of the data/*_settings.json file. There are three different settings files: development, staging, and production. The file that is loaded depends on the value of your DEPLOYMENT_TARGET environment variable. If this variable is missing or empty, the development settings file will be loaded.

More Repositories

1

beeswithmachineguns

A utility for arming (creating) many bees (micro EC2 instances) to attack (load test) targets (web applications).
Python
6,436
star
2

wordpress-mtv

MVC-style framework for building WordPress themes and plugins
PHP
140
star
3

django-boundaryservice

A ready-to-deploy system for aggregating regional boundary data (from shapefiles) and republishing that data via a RESTful JSON API.
Python
82
star
4

hello_newsroom

A simple demonstration of a GeoDjango application.
Python
52
star
5

englewood

Englewood is a python library for generating maps from maps.
Python
41
star
6

boundaryservice

A self-contained example site for django-boundaryservice.
Python
39
star
7

making-maps-demo

35
star
8

wordpress-deploy

Scripted push-button deployment and automated setup for Wordpress and Wordpress Network.
PHP
34
star
9

awsmonitors

Cron scripts that report metric data to Amazon CloudWatch
Perl
33
star
10

refine-stats

A statistics extension for Google Refine.
Java
33
star
11

cloud-commander

Scripts and scripts you can use to quickly launch and build ec2 instances.
Python
30
star
12

tarbell-0.8

CSS
30
star
13

chicagocrime

Sample app and documentation for the Chicago Tribune's Crime in Chicago API.
JavaScript
26
star
14

appengine-autotweeter

A simple AppEngine application for auto-tweeting from an RSS feed.
Python
16
star
15

p2p-python

Wrapper for Tribune's Content Services API
Python
15
star
16

guides

Guides and best practices for Tribune News Apps
14
star
17

servers

AWS server builder
Python
13
star
18

ctabustracker

A python wrapper for the Chicago Transit Authority's Bustracker API.
Python
12
star
19

wordpress-mtv-examples

A couple example themes for WordPress MTV
PHP
11
star
20

layercake

Tools for publishing "live-blog" content to a Tribune Co. content management system.
JavaScript
10
star
21

deploy-tools

Deployment related templates and code
Python
10
star
22

ilcampaignfinance

Parsing and processing Illinois campaign finance data from the Illinois State Board of Elections.
Python
9
star
23

tribapps-gis

A repo storing our various GIS files we would like to share.
Python
8
star
24

story-carder

A simple web app that lets you enter in your story cards, a la the Menlo Innovations way, and print them for your storyboard.
7
star
25

python-chicago

Chicago meta info and other fun stuff
Python
7
star
26

public-notebooks

For public documentation of data analysis.
Jupyter Notebook
6
star
27

bing-bulk-geocoder

Python library to make bing bulk geocoding a wee bit easier.
Python
6
star
28

gallery

Generate big-photo galleries from Tribune Co. CMS
JavaScript
6
star
29

jobs

Job postings
5
star
30

pandascrapers

Python
4
star
31

tostones

Easy local testing and deployment to S3 of TableSetter tables.
JavaScript
4
star
32

python-boundaries

Python wrapper for the Tribune's Boundary Service app.
3
star
33

python-illinois-school-report-card

Python package for working with Illinois Board of Education School Report Card data, Chicago Tribune-style.
Python
3
star
34

wp-project

Messing around with organizing a WordPress project
Python
3
star
35

django-autosharing

Simple Django app for periodically sharing Django models via social media.
Python
2
star
36

swimlanes

Swimlanes for Unfuddle
JavaScript
2
star
37

python-chicago-elections

Parser/scraper for election results from the Chicago Board of Elections website
HTML
2
star
38

tribune-pollster

A serverless API for storing user responses to poll questions.
Python
1
star
39

p2p_test

simple app to test content creation through p2p API
Python
1
star
40

ncaa-high-school-course-scraper

Scraper for the NCAA's Elgibility Center high school portal.
Python
1
star
41

flask-bakery

A work in progress...
Python
1
star
42

gatsby-test

Basic Gatsby starter
JavaScript
1
star