bit.ly/mmcl-wp
Learning Outcomes
- Understand underlying infrastructure of web sites
- Understand infrastructure/workflow of WordPress
- Understand best practices for publishing
Contents
Part 1: The Web
Part 2: WordPress
Part 3: Best Practices
Part 1: The Web
1. Understanding web-related concepts
- Internet vs World Wide Web (HTTP)
- 1969: ARPAnet
- 1974: SQL
- 1989: World Wide Web, HTML
- 1995: MySQL, PHP, JavaScript
- 1996: CSS
- 2003: WordPress
- Server vs client
- Host
- URL, domain
- Front-end (client-side) languages
- HTML: Skeleton
- CSS: Skin
- Singular file vs compartmentalized files
- 'Reset' method
- JavaScript: Nerves
- Barebones code vs frameworks (React.js, Angular.js, Node.js, ...)
- Back-end (server-side) languages
- Processing languages: Brain
- PHP, .NET
- Databases: Memory
- MySQL, MongoDB, PostgreSQL ...
- Processing languages: Brain
- Analogy: Restaurant
- Experience technologies
- Web browsers: Google Chrome, Mozilla Firefox, Safari, Opera, Microsoft Edge
- Devices (viewports): Desktop, mobile
- W3C
- Consortium of influential stakeholders
- Code-validation tools
- Guidelines & initiatives (WCAG)
2. Understanding HTML basics
- Overview of HTML (.HTML or .HTM)
- Purpose?
- Coding vs WYSIWYG
- HTML elements
- Most are pairs of tags (
<element>
and</element>
) - Opening tags: Can have attributes with attribute values
- LIFO (nested) syntax
- Most are pairs of tags (
- Attributes & attributes values
id
: One instance of any given value on pageclass
: One or more instances of any given value- Multiple values for same attribute separate by spaces
- Best practice: Values should convey general purpose, not specific appearance (
class="highlight
" vsclass="yellow"
)
- Anatomy of HTML document
<!DOCTYPE html>
(no closing tag)<html>
<head>
<title>
[Some title]</title>
- Metadata:
meta
(no closing tags) - Links to CSS/font files:
link
(no closing tags) - Links to JavaScript files and/or embedded JavaScript code (
src
)
</head>
<body>
- [Majority of code]
</body>
</html>
- Block-level elements
- Containers:
div
(HTML5:header
,nav
,section
,article
,aside
,footer
) - Headings:
h1
,h2
,h3
, etc - Paragraphs:
p
- Lists:
ol
,ul
- List-items:
li
- List-items:
- Tables:
table
,th
,tr
,td
- Containers:
- Inline elements
- Images:
img
- Common attributes:
src
,alt
,width
,height
- Common attributes:
- Links:
a
- Common attributes:
href
,name
- Common attributes:
- Formatting:
strong
(notb
),em
(noti
)
- Images:
3. Understanding CSS basics
- Overview of CSS (.CSS)
- Purpose?
- Inline styling (
style
HTML attribute) vs external stylesheet(s) - 'C' in CSS is for cascading inheritance
- CSS syntax
Selector(s) {
Property: Value;
}
- CSS selectors
- HTML element with or without HTML
id
/class
value, only HTMLid
value, or only HTMLclass
valueelement
element#id
element.class
#id
.class
- Multiple selectors?
- Different types of elements separated with commas (
div, p { Property: Value;}
) - Different types of elements within hierarchy separated with spaces (
div p { Property: Value}
)
- Different types of elements separated with commas (
- More specific = more precedence
- HTML element with or without HTML
- Common CSS properties
- Colours:
color
,background-color
- Hexadecimal format:
#123456
(each digit/character can be0
-9
orA
-F
) - Always be mindful of appropriate contrast! (Adobe Color Accessibility Tools)
- Hexadecimal format:
- Fonts:
- Non-universal fonts require font-files on same server or reliable external server (Google)
- Colours:
Part 2: WordPress
1. Understanding WordPress infrastructure
- Overview of WordPress
- Very customizable CMS (blog)
- Back-end framework
- PHP files (snippets of code)
- Created MySQL database (accessible through PHPMyAdmin)
- Front-end framework
- HTML code (most in PHP files, some in HTML files)
- CSS files
- JavaScript files
- Hosted on WordPress.com or WordPress package downloaded, the uploaded & set up on server
- Directories (folders) of WordPress package
- [root]
wp-admin
wp-content
plugins
themes
wp-includes
- [root]
- Content constructs
- Posts vs Pages: Date-specific or persistent content?
- Categories vs Tags: General or specific topic?
- Function constructs
2. Understanding WordPress tools
- WP-Admin dashboard
- Side panel: Posts, Media, Pages, Comments, Appearance (Themes, Widgets), Tools, Settings
- Main panel: Depends on active (sub)item in side panel
- WordPress Editor (posts/pages)
- Default editor:
- WYSIWYG
- Fluid blocks comparable to HTML elements
- Contextual, floating toolbar & options panel
- Elements can have HTML code
- Default editor:
Part 3: Best Practices
1. Writing accessible code
- Use HTML headings
- One
h1
per page - Logical nesting of subheadings (
h2
, h3, etc)
- One
- Add text descriptors to images (
alt
attribute value forimg
element)- Max 2 sentences
- No redundant text ("image of")
alt=""
for decorative images
- Use unique hyperlink text for unique hyperlinks ("Read more about [...]" vs "Read more")
- Ensure sufficient colour contrast
- WCAG 2.1: AA vs AAA
- Use HTML elements as intended
- Tables for tabular data, not content structure (exception is HTML emails)
- Explain abbreviations (use
abbr
element if not using parenthetical text)- First instance on each page
2. Exploring tips & troubleshooting
- Within-page links
- Add id value to relevant HTML element (
id="top"
as HTML ortop
as HTML Anchor value in WordPress) - Create link with
href
value referencingid
value (a href="#top"
as HTML or#top
in WordPress)
- Add id value to relevant HTML element (
- Google Analytics
- Add generated code to universal page-template file (after HTML
head
element)
- Add generated code to universal page-template file (after HTML
- WordPress never-ending saving
- Save manually and often
- Close browser tab if "Saving..." loop happens
- WordPress changes not showing
- Clear site cache using built-in tool if applicable or third-party plugin
- WordPress external View Page tab not loading
- Close browser tab with WordPress editor
Resources
Coding
MMCL
- mmcl@yorku.ca
- bit.ly/yu-mmcl
- Signup for MMCL mailing List