Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
"Into to PHP" Milwaukee WordCamp
Search
Suzette Franck
July 25, 2014
Technology
1
680
"Into to PHP" Milwaukee WordCamp
Introduction to PHP for WordPress.
Suzette Franck
July 25, 2014
Tweet
Share
More Decks by Suzette Franck
See All by Suzette Franck
Accessibility For Everyone
suzettefranck
0
40
Website Considerations
suzettefranck
0
57
Website Weekend WP Basic Training by Karen McCamy
suzettefranck
0
3.1k
Intro to Sass for WordPress Theme Developers
suzettefranck
0
81
Ten Features of Jetpack You Can’t Live Without
suzettefranck
1
180
Introduction to Security and Backups
suzettefranck
0
170
Customizing the WordPress Admin Without Code
suzettefranck
1
800
"Choosing a WordPress Host" - Hollywood WordPress
suzettefranck
1
440
WordPress Wizardry Without Code - Chicago WordCamp
suzettefranck
0
350
Other Decks in Technology
See All in Technology
tokyo_re_Growth2024_yoshi
yoshi22
0
120
Tailwind CSSとAtomic Designで実現する効率的な Web 開発の事例
toranoana
1
280
2024年のModern Data Stackを振り返ろう~分野別の目玉アップデート情報まとめ~
sagara
0
540
IVRyエンジニア忘年LT大会2024 クリティカルユーザージャーニーの整理
abnoumaru
0
140
Splunk Enterpriseで S3のデータを直接検索してみた!
recruitengineers
PRO
2
100
Amazon Bedrock Multi-Agent Collaboration Workshop の紹介 - ワークショップでAIエージェントを学ぼう
nasuvitz
4
370
プロセス改善とE2E自動テストによる、プロダクトの品質向上事例
tomasagi
1
4.1k
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
5
52k
Classmethod_regrowth_2024_tokyo_security_identity_governance_summary
hiashisan
0
800
AIのコンプラは何故しんどい?
shujisado
1
110
Reliability Engineering at Studist
katsuhisa91
PRO
0
130
プロダクトの爆速開発を支える、 「作らない・削る・尖らせる」技術
applism118
10
9.4k
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
327
38k
Typedesign – Prime Four
hannesfritz
40
2.4k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5k
How STYLIGHT went responsive
nonsquared
95
5.2k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Facilitating Awesome Meetings
lara
50
6.1k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Transcript
Intro to PHP Suzette Franck WordPress Evangelist, (mt) Media Temple
2014 Milwaukee WordCamp Foundation Friday, July 25, 2014 #wcmke @mt_Suzette Media Temple // 8520 National Blvd. Culver City, CA 90232 / 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Suzette Franck with a “ck” Twitter: @mt_Suzette ★WordPress Evangelist @ (mt) Media Temple ★Using WordPress since version 2.7 in 2008 ★20 years of web development experience ★Created 200+ WordPress custom themes ★Spoke at 20 WordCamps since 2011 ★WordPress Podcast WPUnicornProject.com https://www.youtube.com/user/mediatemple ★Reg. Contributor on WPwatercooler.com ★Blogs at: suzettefranck.com ★Slides: speakerdeck.com/suzettefranck
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple ★What is PHP ★Tools ★Look at PHP Code ★Resources What We Will Cover
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple PHP - What is it?
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple PHP - What Is It? ★Originated as Personal Home Page Tools, now it’s PHP Hypertext Preprocessor ★Server-Side Scripting Language (PHP) vs. Client-Side Scripting Language (Javascript) ★<?php ...code... ?> alongside HTML ★Files must have .PHP extension ★Needs to be run on a server, outputs HTML ★Open Source, free, needs updates occasionally ★Runs on Apache and most web servers or OS
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple The LAMP Stack PHP Apache Linux MySQL ★PHP is part of LAMP ★PHP processes code into HTML ★PHP talks to MySQL Database ★PHP evaluates form submissions
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple PHP - Tools
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple What You’ll Need: ★Knowledge of HTML & some CSS ★Text Editor ★A Modern Browser w/Internet ★Google and codex.wordpress.org ★Web Host or Local Host running WordPress
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple PHP Code Editors
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Paid, Free to Try Free, Open Source ★Any old text editor will do ★Requirements: line numbering & syntax highlighting Sublime Text 2 (MacOS) Notepad++ (PC) PHP Code Editors
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Sublime Text 2 (index.php of 2014)
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Notepad++ (for PC)
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Web Server
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple ★PHP 5.2.4 or higher ★MySQL 5.0 or higher ★Latest Version of WordPress 3.9.1 Your Web Host Your Computer Web Servers
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple ServerPress.com
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Desktop Server
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Where Are The Templates? ★On Desktop Server: Documents/Websites/sitename.dev/ wp-content/themes/themename/
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Helpful Plugins
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Which Template? ★“What The File” Free WordPress Plugin
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Let’s Look At Code!
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Comments in PHP <?php // single line ?> <p>Some text.</p> <?php # single line ?> <p>Some text.</p> <?php /* multi line com- ments are fun */ ?> <p>Some text.</p> <?php // single line # single line /* multi line com- ments are fun*/ ?>
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Anatomy of a Function ★PHP Code Opening/Closing Tag ★WordPress or PHP Function ★Optional Parameters ★Line Terminator <?php bloginfo(‘name’); ?>
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Anatomy of a Variable ★PHP Code Opening/Closing Tag ★Variable Name, starts with $ ★Operator (Assignment) ★Value (String) ★Line Terminator <?php $eggs = “green”; ?>
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Variables & Data Types
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple PHP Data Types ★What you can do depends on data type ★Variables can change data type ★Versatile, but slower than other languages ★Strings ★Integers and Floating Point Numbers ★Boolean (true false) ★Arrays (multiple values) ★Null
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Strings ★PHP Code Opening/Closing Tag ★Variable Name, starts with $ ★Operator (Assignment) ★Value (String) ★Line Terminator <?php $eggs = “green”; ?>
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Integers ★PHP Code Opening/Closing Tag ★Variable Name, starts with $ ★Operator (Assignment) ★Value (Integer) ★Line Terminator <?php $eggs = 3; ?>
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Boolean ★PHP Code Opening/Closing Tag ★Variable Name, starts with $ ★Operator (Assignment) ★Value (boolean) ★Line Terminator <?php $eggs = 0; // false ?>
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Arrays ★PHP Code Opening/Closing Tag ★Variable Name, starts with $ ★Operator (Assignment) ★Value (array) ★Line Terminator <?php $eggs = array(“green”, “red”, “blue”); ?>
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Null ★PHP Code Opening/Closing Tag ★Variable Name, starts with $ ★Operator (Assignment) ★Value (Null) ★Line Terminator <?php $eggs = NULL; ?>
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Echo and Print
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Echo and Print Statements I’d like green eggs. I’d like 3 eggs. ★echo() outputs one or more strings. ★print() outputs one string and a value of 1 ★echo() is marginally faster ★Both are language constructs ★CaSe InSensitive ★Both can be used with or without () ★Can include HTML and variables ★Single or double quotes
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Echo and Print Statements <?php $eggs = “green”; echo “<p>I’d like $eggs eggs. ”; $eggs = 3; echo “I’d like $eggs eggs.</p>”; ?> I’d like green eggs. I’d like 3 eggs.
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple All Together Now <?php $year = date(‘Y’); // sets year echo “Copyright © $year.”; ?> Copyright © 2014.
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Advanced Example $year = date(‘Y’); // sets year $name = get_bloginfo(‘name’); // sets name $email = get_bloginfo(‘admin_email’); // sets email echo “Copyright © $year by <a href='mailto:$email'>$name</a>."; Copyright © 2014 by Intro to PHP.
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Operators in PHP Arithmetic + - * / % Assignment = += -= *= /= %= String Concatenation . .= Increment/Decrement $x++ $x-- Comparison == != <> !== > < >= <= Logical && and || or xor !
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Anatomy of a Statement <?php $year = date(‘Y’); // sets year ?> <?php if (have_posts()) : ?> <!-- do stuff ... --> <?php endif; ?> <?php if (have_posts()) { // do stuff } endif; ?>
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Anatomy of a The Loop <?php $year = date(‘Y’); // sets year ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <!-- do stuff ... --> <?php endwhile; ?> <?php endif; ?>
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Resources
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Recommended Books “WordPress Web Design for Dummies” by Lisa Sabin-Wilson
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Recommended Videos “WordPress Web Design for Dummies” by Lisa Sabin-Wilson
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Recommended Websites http://codecademy.com
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Recommended Websites Google all the things!
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Recommended Websites http://www.w3schools.com
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Recommended Websites http://php.net/manual/en/
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Recommended Websites http://codex.wordpress.org
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple In Summary
Media Temple // 8520 National Blvd. Culver City, CA 90232
/ 877-578-4000 / mediatemple.net / @mt_Suzette © 2014 (mt) Media Temple Things to Remember ★Follow the script logic flow ★Dissect code part-by-part ★Look up php functions in google ★Variables are different data types ★Functions performed based on data types ★Have fun and learn!
Questions? Suzette Franck
[email protected]
https://speakerdeck.com/suzettefranck HAVE FUN AND LEARN! @mt_Suzette
Follow Me On Twitter!