Академический Документы
Профессиональный Документы
Культура Документы
Dreamweaver
Editing
a
WordPress
theme
with
Dreamweaver
CS5
Part
1:
Learning
the
basics
http://www.adobe.com/devnet/dreamweaver/articles/dw_wordpress_pt1.html
Introduction
o The
most
popular
blog
software
today
Has
emerged
into
a
full
content
management
system
o The
beauty
the
separation
of
content
and
style
The
content
is
stored
in
a
MySQL
database
Pieces
of
the
WordPress
puzzle
o Two
options
Host
WordPress
You
will
need
PHP
and
MySQL
on
your
computer
Set
up
WordPress
on
your
machine
Host
the
blog
through
WordPress.com
How
WordPress
works
o Lots
of
files
are
installed
These
allow
WordPress
to
run
your
blog
o You
use
the
administration
area
to
run
your
blog
Also,
tell
WordPress
which
theme
to
use
o The
WordPress
files
Assemble
the
page
based
on
the
options
you
set
o You
dont
need
to
rebuild
all
of
your
pages
each
time
the
blog
is
updated
The
WordPress
template
file
hierarchy
o Like
pieces
of
a
puzzle
When
added
together
they
form
complete
web
pages
o Some
pages
are
used
on
every
page
of
your
blog
header
footer
o index.php
is
required
in
every
theme
o home.php
Takes
precedence
over
index.php
The
WordPress
page
structure
o Open
index.php
Code
View
o Three
basic
sections
header
content
footer
o Other
pages
are
referenced
from
the
theme
directory
o Look
for
these
three
lines
of
code
<?php
get_header();
?>
<>php
get_sidebar();
?>
<>php
get_footer();
?>
By
having
three
separate
files,
allows
consistency
among
the
other
pages
in
the
site
o Find
this
code:
<?php
if
(
have_posts()
)
:
while
(
have_posts()
)
:
the_post();
?>
Editing
a
WordPress
theme
with
Dreamweaver
CS5
Part
2:
Setting
up
your
site
http://www.adobe.com/devnet/dreamweaver/articles/dw_wordpress_pt2.html
Dreamweaver
o Click
Go
o Go
to:
http://localhost/wordpress/wp-admin/install.php
Click
Create
configuration
file
Click
Lets
Go
Enter
database
name:
wordpress
username:
dreamweaver
password:
development
database
host
type:
localhost
Click
Submit
Click
Run
Install
Enter
the
information
for
your
WordPress
site:
Set
Title:
Dreamweaver
Username:
admin
Password:
development
Email
address:
enter
your
email
address
Click
Enter
Install
the
theme
files
and
set
up
your
site
in
Dreamweaver
o Installing
the
theme
files
Copy
the
MyTheme
folder
into
the
WordPress
themes
folder
o Set
the
theme
in
WordPress
Go
to:
http://localhost/wordpress/wp-admin/
Log
in
to
WordPress
Click
Appearance
Select
the
Adobe
Developer
Connection
Theme
1.0
by
Codify
Design
Studio
Activate
this
theme
Go
to:
http://localhost/wordpress/
Make
sure
the
theme
is
active
for
your
blog
o Setting
up
your
site
in
Dreamweaver
Site
>
New
Site
Site
Setup
for
Unnamed
Site
dialog
box
o Site
name:
blog
o Local
site
folder:
wordpress
folder
o Click
on
Servers
(the
left
side)
Click
the
Plus
button
Stay
in
Basic
Server
Name:
localhost
Connect
using:
Local/Network
Server
Folder:
wordpress
folder
Web
URL:
http://localhost/wordpress/
o Setting
up
site-specific
code
hinting
Dreamweaver
can
have
WordPress-specific
PHP
code
hints
Dreamweaver
supports
three
frameworks
by
default:
Drupal
Joomla!
WordPress
Site
>
Site-Specific
Code
Hints
Editing
a
WordPress
theme
with
Dreamweaver
CS5
Part
3:
Adding
a
logo,
header
styles,
and
menu
http://www.adobe.com/devnet/dreamweaver/articles/dw_wordpress_pt3.html
Dreamweaver
CSS
Styles
panel
o Current
Area
o Look
at
the
Properties
for
.bannerArea
.container
o Height:
83px
Create
your
logo
Open
Adobe
Illustrator
File
>
New
o New
Document
dialog
box
Name:
blog_head
New
Document
Profile:
Web
Width:
300px
Height:
83px
Click
OK
Type:
Company
Blog
Add
a
logo
icon
o Window
>
Symbols
File
>
Save
For
Web
&
Devices
o PNG-24
o Export
blog_head.png
Place
in
the
images
directory
of
the
local
theme
Inserting
the
logo
in
your
theme
Open
header.php
MyTheme
folder
Code
View
Delete
the
following
code:
<p
class="title"><a
href="<?php
echo
get_option('home');
?>/">
<?php
bloginfo('name');
?>
</a><br
/>
<span
class="description">
<?php
bloginfo('description');
?>
</span></p>
Common
Area
of
the
Insert
panel
Insert
>
Image
o blog_head.png
o Image
Tag
Accessibilities
dialog
box
Alt
Text:
Company
Blog
Click
OK
Split
View
Notice
the
newly
created
image
Linking
the
logo
Design
View
Select
the
image
o Properties
Inspector
Link:
#
Code
View
Delete
the
#
sign
Replace
with:
<?php
echo
get_option(home);
?>
o This
is
a
WordPress
option
to
takes
a
user
to
the
homepage
Img
tag
o Add
border=0
Dreamweaver
Click
on
the
Hello
World!
Link
Tag
Selector
<a>
New
CSS
Rule
o New
CSS
Rule
dialog
box
Selector
Type:
Compound
Selector
Name:
.posttitle
a:hover
Less
Specific
five
times
Rule
Definition:
style.css
Click
OK
o CSS
Rule
definition
for
.posttitle
a
in
style.css
dialog
box
Category:
Type
Color:
#555
Click
OK
Adding
a
menu
system
o Open
functions.php
(MyTheme
folder)
o Add
the
following
code
(before
the
closing
?>
tag):
add_action(
'init',
'register_my_menu'
);
function
register_my_menu()
{
register_nav_menu(
'primary-menu',
__(
'Primary
Menu'
)
);
}
o This
code
will
register
the
menu
It
tells
WordPress
that
your
theme
will
use
the
new
menu
system
o We
will
now
add
the
code
to
the
header
to
tell
WordPress
where
to
insert
the
menu
o Open
header.php
(MyTheme
folder)
o Delete
navigation
goes
here
o Insert
the
following
code
(where
the
text
previously
was):
<?php
wp_nav_menu(
array(
'theme_location'
=>
'primary-menu'
)
);?>
o Go
to
a
browser
Open:
http://localhost/wordpress/wp-admin/
Click
Appearance
Click
Menus
Menu
Name:
Primary
Menu
Click
Create
Menu
In
the
Pages
section
o Click
View
All
o Select
each
of
the
pages
listed
o Click
Add
to
Menu
o Click
Save
Menu
o The
pages
are
listed
as
gray
boxes
in
the
Primary
Menu
area
You
can
drag
the
pages
to
reorder
how
they
will
appear
o Dreamweaver
Refresh
Live
View
o We
will
style
the
menu
bar
slightly
New
CSS
Rule
New
CSS
Rule
dialog
box
o Selector
Type:
Compound
o Selector
Name:
li.menu-item
Editing
a
WordPress
theme
with
Dreamweaver
CS5
Part
4:
Building
a
custom
home
page
http://www.adobe.com/devnet/dreamweaver/articles/dw_wordpress_pt4.html
Dreamweaver
o
o
o
o
10
Click
OK
Delete
the
text
inserted
and
keep
your
cursor
there
Common
Area
of
the
Insert
Panel
o Insert
Div
Tag
Insert
Div
Tag
dialog
box
Insert:
At
insertion
point
ID:
featuredPosts
Click
OK
Tag
Selector
<div#featureWrapper>
CSS
Styles
Panel
New
CSS
Rule
New
CSS
Rule
dialog
box
o Selector
Type:
ID
o Selector
Name:
#featureWrapper
Rule
Definition:
style.css
Click
OK
o CSS
Rule
definition
for
#featureWrapper
in
style.css
dialog
box
Category:
Block
Text-align:
Center
Category:
Background
Background-color:
#333
Category:
Box
Width:
100%
Clear:
Both
Tag
Selector
<div#featuredPosts>
CSS
Styles
Panel
New
CSS
Rule
New
CSS
Rule
dialog
box
o Selector
Type:
ID
o Selector
Name:
#featuredPosts
Rule
Definition:
style.css
Click
OK
o CSS
Rule
definition
for
#
featuredPosts
in
style.css
dialog
box
Category:
Type
Color:
#fff
Category:
Block
Text-align:
Left
Category:
Box
Width:
940px
Height:
200px
Padding
o Deselect
Same
for
all
o Top:
20px
o Right:
0
o Bottom:
20px
o Left:
20px
Margin
o Deselect
Sam
for
all
Top:
0
Right:
auto
Bottom:
0
Left:
auto
Click
OK
View
the
file
Type
http://localhost/
in
the
address
bar
Create
the
featured
post
containers
We
want
to
have
three
posts
across
the
feature
area
We
will
need
containers
to
hold
these
posts
Inside
the
featured
posts
div
Create
three
new
divs
with
a
class
of
featurebox
Delete
the
text
inserted
and
keep
your
cursor
Content
for
id
"featuredPosts"
Goes
Here
Common
Area
of
the
Insert
Panel
o Insert
Div
Tag
Insert
Div
Tag
dialog
box
Insert:
At
insertion
point
Class:
featurebox
Click
OK
Place
your
cursor
after
the
newly
created
div
Common
Area
of
the
Insert
Panel
o Insert
Div
Tag
Insert
Div
Tag
dialog
box
Insert:
At
insertion
point
Class:
featurebox
Click
OK
Place
your
cursor
after
the
newly
created
div
Common
Area
of
the
Insert
Panel
o Insert
Div
Tag
Insert
Div
Tag
dialog
box
Insert:
At
insertion
point
Class:
featurebox
Click
OK
CSS
Styles
Panel
New
CSS
Rule
o New
CSS
Rule
dialog
box
Selector
Type:
Class
Selector
Name:
.featurebox
Rule
Definition:
style.css
Click
OK
o CSS
Rule
definition
for
#
.featurebox
in
style.css
dialog
box
Category:
Box
Width:
290px
Float:
Left
Padding
o Deselect
Same
for
all
o Right:
20px
11
Dreamweaver
o
o
o
o
12
Click
OK
We
will
add
some
content
in
the
featurebox
divs
Delete
the
text
Content
for
class
"featurebox"
Goes
Here
Type:
<h1>This
is
a
sample
post
title</h3>
<p>Lorem
ipsum
dolor
si
amet
</p>
CSS
Styles
Panel
New
CSS
Rule
New
CSS
Rule
dialog
box
o Selector
Type:
Compound
o Selector
Name:
#featuredPosts
h3
Rule
Definition:
style.css
Click
OK
o CSS
Rule
definition
for
#
featuredPosts
h3
in
style.css
dialog
box
Category:
Type
Font-weight:
normal
Color:
#f90
Category:
Block
Letter-spacing:
normal
Click
OK
We
now
need
to
add
the
thumbnail
and
text
link
for
each
post
In
each
of
the
featurebox
divs,
add:
<p><img
src="thumb.jpg"
/>Lorem
impsum
dolor
si
amet
</p>
<p
class="readit"><a
href="#">Read
more</a></p>
Copy
and
paste
into
all
three
featured
posts
divs
CSS
Styles
panel
New
CSS
Rule
New
CSS
Rule
dialog
box
o Selector
Type:
Compound
o Selector
Name:
#featuredPosts
img
Rule
Definition:
style.css
Click
OK
o CSS
Rule
definition
for
#
featuredPosts
img
in
style.css
dialog
box
Category:
Box
Float:
Left
Margin
o Deselect
Same
for
all
o Right:
8px
Category:
Border
Leave
all
three
Same
for
all
checkboxes
selected
Style:
solid
Width:
3px
Color:
#000
Click
OK
New
CSS
Rule
New
CSS
Rule
dialog
box
o Selector
Type:
Compound
13
Dreamweaver
14
o Categories
panel
Publish
(top
right
of
the
sidebar)
Click
Save
Draft
This
post
will
not
be
visible
until
we
choose
publish
Upload
an
image
Click
the
Media
tab
(left
sidebar)
Click
Add
New
Browse
to
an
image
Click
the
image
in
the
Media
library
Select
the
entire
contents
of
the
File
URL
box
and
copy
it
Click
Posts
(left
sidebar)
Click
the
name
of
the
post
Custom
Fields
option
Name:
featurethumb
Value:
Paste
the
copied
File
URL
Click
Add
Custom
Field
Click
Publish
Creating
a
custom
featured
post
loop
o Remove
the
sample
content
Remove
all
but
one
of
the
featurebox
divs
Remaining
featurebox
div
Remove
the
sample
post
text
Leave
the
tags
o <h3>
o <p>
o <Img>
<h3></h3>
<p><img
src="thumb.jpg"
/></p>
<p
class="readit"><a
href="#">Read
more</a></p>
o Create
a
new
post
loop
WordPress
posts
are
displayed
using
a
loop
We
will
place
this
loop
inside
the
featuredPosts
div
We
will
loop
through
the
featured
posts
category
o Maximum
of
three
The
featurebox
div
will
be
inside
the
loop
o They
will
be
repeated
Change
featuredPosts
to:
<div
id="featuredPosts">
<?php
$featuredPosts
=
new
WP_Query();
$featuredPosts->query('category_name=featured&showposts=3');
while($featuredPosts->have_posts())
:
$featuredPosts->the_post();
?>
<div
class="featurebox">
<h3><?php
the_title();
?></h3>
<p><img
src="<?php
echo
get_post_meta($post->ID,
'featurethumb',
true);
?>"
/><?php
the_excerpt();
?>
15