Transcript
Page 1: The Anatomy of a WordPress File

The Anatomy ofa WordPress CSS File

WordCamp 2014April 14 – 15, 2014

Atlanta, Georgia

Page 2: The Anatomy of a WordPress File

2

What We Will Discuss

• Cascading Style Sheets• Theme Styling Options • Primary Edit Files• Identifying Edit Requirements• Inspecting the Element• Locating Edit Files• Editing the Code• Viewing the Results

Page 3: The Anatomy of a WordPress File

3

CSS Styling Options

• Theme Options• Built In Custom Fields (ex: Widgets)• Editor Files

Page 4: The Anatomy of a WordPress File

4

Theme Styling Options

Page 5: The Anatomy of a WordPress File

5

Theme Styling Options Example

Page 6: The Anatomy of a WordPress File

6

Widget Styling Options

Page 7: The Anatomy of a WordPress File

7

Footer Text Color Edit – Before and After

Page 8: The Anatomy of a WordPress File

8

Primary WordPress Style Sheets

• Three primary WordPress Style Sheets– style.css– header.php– footer.php

Page 9: The Anatomy of a WordPress File

9

Accessing WordPress Style Sheets

• Follow this path– Dashboard > Appearance > Editor

• Back Up Prior to Editing

Page 10: The Anatomy of a WordPress File

10

Locating Primary Style Sheets

Page 11: The Anatomy of a WordPress File

11

header.php

Page 12: The Anatomy of a WordPress File

12

footer.php

Page 13: The Anatomy of a WordPress File

13

Types of Styles

• Tag Style – Create style rules that change HTML code automatically; applies rule every time element appears– h1 { color: #efefef }

• Class Style – You name it; you manually select it– i.e. a div– .infoform{ color: #0076bf }

• ID Style – You can only apply once; use for single unique elements– #box { color: #ffffff}

Page 14: The Anatomy of a WordPress File

14

Things You Should Know

• Basic Code Structure– selector { attribute: value }– h1 {color: #0076bf }

• !important Declarations– !important declarations carry more weight– !important declarations by author carry more weight

then !important declarations by the user– Override with caution– Could affect responsive designs (ex: size of elements)

Page 15: The Anatomy of a WordPress File

15

What Is Contained in the CSS File

• Comment block from the author • A set of style rules for the major elements of the

theme:– h tags– Colors and fonts– Margins and padding– Basic layout of primary elements

• (header, body, sidebars, footers)

• Basic design and layout rules for the theme

Page 16: The Anatomy of a WordPress File

16

Inspecting the ElementThis Example Uses Google Chrome

Using Chrome browser; right mouse click; select Inspect element

Page 17: The Anatomy of a WordPress File

17

Element Identified

Page 18: The Anatomy of a WordPress File

18

Locate CSS Code

Chrome Console shows file name and code line number

Page 19: The Anatomy of a WordPress File

19

Practice with Twenty Eleven ThemeChange Background Color – Inspect the Element

Page 20: The Anatomy of a WordPress File

20

Practice with Twenty Eleven ThemeChange Background Color – Identify Source Line

Page 21: The Anatomy of a WordPress File

21

Practice with Twenty Eleven ThemeChange Background Color – Locate Code

Note: Installed WordPress Advanced Code Editor Plugin.WordPress code does not have line numbers.

Page 22: The Anatomy of a WordPress File

22

Practice with Twenty Eleven ThemeChange Background Color – Enter Color Hex

Page 23: The Anatomy of a WordPress File

23

Practice with Twenty Eleven ThemeChange Background Color – Update File

Page 24: The Anatomy of a WordPress File

24

Practice with Twenty Eleven ThemeChange Background Color – View Change

Page 25: The Anatomy of a WordPress File

25

Practice with Twenty Eleven ThemeReduce Site Title Size – Inspect the Element

Page 26: The Anatomy of a WordPress File

26

Practice with Twenty Eleven ThemeReduce Site Title Size – Edit Code

Page 27: The Anatomy of a WordPress File

27

Practice with Twenty Eleven ThemeReduce Site Title Size – Reduce Size

Page 28: The Anatomy of a WordPress File

28

Practice with Twenty Eleven ThemeReduce Site Title Size – View Change

Page 29: The Anatomy of a WordPress File

29

Some of the Elements You Can EditThere Are So Many Possibilities

Page 30: The Anatomy of a WordPress File

30

Before and After Example

Page 31: The Anatomy of a WordPress File

31

The Anatomy of the CSS File

• Decide what you want to edit• Inspect the element in browser• Find the code in the CSS file• Customize the code• Enjoy the enhancements

Page 32: The Anatomy of a WordPress File

32

Thank You


Recommended