How to configure a server, install WordPress, customize the output, and deploy using git... All in 30 minutes. A presentation for the Philly 'Burbs WordPress Meetup.
2. What's About To Happen?
Live, Unscripted Code
Provided the wifi holds up...
Are you
INSANE???
Oh, yes...
3. The Intent of This Presentation
How One Could Construct and Deploy a WordPress Site in 30
Minutes
Provide Thoughts for Research, Not Detailed Instructions
Generally: Pragmatic ideas for stepping up your game
4. Who Are We?
Owen Winkler
owen@criticalhit.us
You!
WordPress Enthusiasts
Graphic/Web Designers
WordPress Implementers
5. What Do We Need To Begin?
Discovered Requirements
Graphic Assets
Service Credentials
DNS
VPS Hosting
Our Wits
8. Requirements
Produce a site to inform the public about
nutrition bars for their hungry production
facilities.
Each bar will cost a mere $ and will provide a
testimonial.
Someone is very fond of the color .
12. VPS/Cloud Hosting Installation
Steps
1. Choose and configure
2. Record the IP address used for the server:
3. Download and execute the
w e - - - ht :/ sm u /p np uu t1 0 _n p| bs
gt q O
tp / ay .s si u _b nu 24 lm
ah
16. Host Config
Does have LNMP spun up?
Create a directory to house the site.
m dr - /a /w /p oe w cm hd c
k i p vr ww w .w n. o/ t os
c /a / w/ po ew cm h dc
d v rw ww .w n .o /t os
17. Speed Test
< DC YE hm >
! OT P t l
< tl
h m>
< ed
h a>
<i l> mI Fs ? /i l>
tt e A
a t< tt e
<t l tp =t x/ s" . at { cl r g e n } . lw {c lr r d fn -e gt
sy e ye "e t cs > fs
oo : re ;
so
oo : e ; ot w ih :
< ha >
/ ed
< oy
b d>
< 1A lo t ee so l b ge n< h>
h >l f h s h ud e re : /1
< pp fn to t s( vl { eh $ a ?' sa c as "a t ># 21 ;/ pn ' :' sa c a
? h u ci n e t $a )
c o vl
< p n l s =f s" &x 73 < sa >
<pn l
<l
d>
<t Ui gN IX < d>
d> s n GN :/ t
<d <p pt s( r gm th 'n i x' $S R E[ SR E_ O TA E] ) ?< d>
d> ? h et pe _a c (# gn #, _ EV R' E VR SF WR ') ; >/ d
<t Ui gP Pa F sC I <d >
d> s n H s at G: /t
<d <p pt s( r gm th 'f g #, pp sp _a e )) ? <d >
d> ? h et pe _a c (# ci ' h_ a in m( ); > /d
<t Ui gP PF M <d >
d> s n H- P: /t
<d <p pt s( r gm th 'f m ' p ps p _a e) ) ?< d>
d> ? h et pe _a c (# p# , h_ ai nm ( ); > /d
<t Ea ld AC < d>
d> n be P :/ t
<d <p pt s( u ci ne it ( ac cc ei f' & @ p_ ah _n o 'p oe );
d> ? h et fn to _ xs s' p_ ah _ no ) & a c cc ei f( oc d ')
<t Ea ld MS L Qa h: /t
d> n be y Q Cc e <d >
<d <p p
d> ? h
$ on =n wm sl ( lc lo t, ' ot ,' )
cn
e yq i' oa h s' r o' ' ;
$ r = $ on >u r( so v ra l sl k ' u r_ ah _i e ";
qy
c n- qe y "h w ai be i e qe yc c es z' )
ts (n vl $r - ft ho jc ( -V le > 0;
et i ta (q y> ec _ be t) >a u)
)
?< d>
>/ d
< bd >
/ oy
< hm >
/ tl
19. Configure the Local WordPress
Environment
1.
2.
3.
4.
5.
Setup local DNS
Setup local web root
Setup local database
Setup version control with a copy of WordPress
Set up a simple theme
20. Local Web Root & Database
Local Web Root will be different for everyone
m dr - // ap /t os v rw .l ie
k i p cx mp h dc /d /p c ar
c // a p/ to sv rw . li e
d c xm ph dc / d/ pc ar
Database is generally the same for everyone
m sl -r o
y q u ot
c et d tb s w ;
r ae a aa e p
21. Setup Version Control
1.
2.
3.
4.
Using git and GitHub!
on GitHub for your site named "wp"
and extract WordPress to your local environment
Initialize the repo with the WordPress files
Push the files from your local environment to the newly
created repo at GitHub
c r h t :/ od rs .r / ae tt rg | tr xz
u l tp /w rp e so gl ts . a. z
a v
m wr p es hd c; c hd c
v o dr s to s d t os
g ti i
i nt
g ta d.
i d
g tc mi - "d e Wr P es t sa t
i o m t m A dd o dr s o tr "
g tr mt a do ii g tg tu . o: ig at rw . i
i e o e d r g n i @ ih bc mr nm s e/ pg t
g tp s - o ii m se
i u h u rg n at r
22. Set up a Simple Theme
Let's build a child theme of twentytwelve!
/
*
T ee Nm :
hm ae
S m oe sW u Br
oe n' ht a s
T ee UI
hm R:
h t :/ ea tc m
tp /r d l. o/
D sr pi n
e ci t o:
A t ee fr te S mo es Wu B r st ,b it a ac id o te t te v
h m o h o en ' h t a s ie ul s
hl f w ny wl
A to :
u hr
O e Wn l r
wn i ke
A to U I
u hr R :
h t :/ wn cm
tp /o e .o /
T ml t:
e pa e
t e tt ev
wn yw l e
V ri n
e so :
10
.
*
/
@ mo tu l" .t e tt ev /t l .s ";
i pr r( ./ wn yw l es ye cs )
If not, then maybe use
...
24. Static Home Page
Our product site is not primarily a blog
Settings » Reading » Front page displays
25. Main Menu
Menus are easy and effective
Create pages as targets
Create a menu
Add the pages to the menu
26. Color Accent
Don't forget that Someone really likes the color .
h m b d .u tm bc go n {
t l oy cs o- a kr ud
bc go n- oo : #0 48
ak r ud cl r 04 8 ;
}
h ,h a .i eh a e h a {
1 1 , s t- ed r 1
cl r #0 48
oo : 04 8;
}
Appearance » Background can set the background color, but...
27. What's this "Word Press" thing?
Let's remove the WordPress credit from the footer.
Copy the existing footer.php from twentytwelve into our custom
wp theme.
28. Kill Comments
We don't want comments on our modern product blog
Override the comments.php template with a blank file!
29. Custom Product Type
Let's create a
listing
to use in a sidebar product
a da to (' nt , 'r ae po u tt p' )
d _c i n ii ' ce t _r dc _y e ;
f nt o ce t_ rd c_ y e) {
u ci n ra ep o ut tp (
rg se _o tt p (' pp ou t ,
ei t rp s_ ye w _ rd c'
ar y
ra (
'a es = ar y
lb l ' > r a(
'a e = _ (' r dc s )
nm ' > _ Po ut ' ,
'i gl rn m' = _( ' rd c' )
sn u a_ ae > _ P ou t
)
,
'u lc = tu ,
pb i ' > r e
'a _r hv '= f le
hs a ci e > as ,
'e rt '= a ry 'l g = 'r dc s)
rw i e > r a (s u' > p ou t' ,
)
)
;
}
30. Things to Know
This can go in functions.php or a new plugin
The custom type can have its own template:
single-{typename}.php
31. Product Widget
Let's
to automatically list items from our
custom product post type
c as Po ut _i g te tn sW _ ig t{
l s r dc sW de x e d PW de
fn to _ cn tu t) {
uc i n _ os r c(
pr n: _c nt u t
ae t :_ os rc (
'r dc sW de '
Po u t_ ig t,
'r dc sW de '
Po u t ig t,
ar y 'e ci to '= ' ip a sa ls ig o Po ut ' )
ra ( ds rp i n > Ds ly
it n f r dc s,
)
;
}
pb i fn to w de ($ rs $ nt ne ) {
ul c uc in i gt ag , is ac
$r s= ar y 'o tt p '= ' pp ou t, 'o t _e _a e = 1 )
ag
r a( p s_ ye > w _r dc ' p ss pr p g' > 0 ;
$o p= nw W_ u r( $r s)
lo
e P Qe y a g ;
eh '
co
Our Products
'
;
wi e( $o p> a ep ss )) : $o p> h_ ot )
hl
l o- hv _o t (
lo -t e ps (;
te tt e)
h_ i l( ;
eh '
co
'
;
te cn et )
h_ o tn (;
eh '
co
'
;
ed hl ;
nw i e
eh '
co
'
;
32. Why not use plugins?
Two answers:
1. Go ahead!
2. More plugins equals more weight, maintenance, and
deployment complication.
34. Deploy Files
Step 1 - Prepare
Make sure everything necessary is in git and pushed to github:
g ts au
i tts
g tc mi - m" pa ee e yh n.
i o m t a U d t vr ti g "
g tp s oi i m s e
i u h rg n at r
The wp-config.php file?
35. Deploy Files
Step 2 - "Upload"
Instead of using SFTP to upload files,
we'll use git to download them directly to the server
c /a / w/ po ew cm
d v rw ww .w n .o
g tc oe ht s/ g tu .o /i g at rw .i h dc
i l n t p: /i hb c mr nm se /p g t t o s
36. Deploy Database
Step 1 - Prepare
Database transfer is complicated... Let's use the
plugin.
c // a p/ to sv rw . li eh dc /p c ne tu la s
d c xm ph dc / d/ pc ar / to sw -o tn / po d
s pw -i rt -. . q r o @p oe wc m/ a /w /p
c p m ga e. .s l ot w. w n. o: vr ww w
37. Deploy Database
Step 2 - Restore
This process overwrites all of the database data on the server
m sl -r o w < w -i rt -. . q
y q u ot p
p mg a e. .s l
41. Missed Some Deployment
Things
Automated deployment. See: capistrano
How are updates to code/core handled?
How are updates from production handled?
How are user uploads handled?
What happens when something goes wrong?
42. Missed Some Security Things
What's with all the "root" access?
MySQL users don't have passwords?
Where are your firewall rules?