Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Everything You Always Wanted to Know About WordPress (but were afraid to ask)

This talk will cover a few key “Aha” moments that you should have about the way WordPress works. We’ll talk about things like the template hierarchy, what’s going on in wp-config, where WordPress content is stored (the database vs. the file system), how posts and pages and custom post types are represented in the database, what folks are talking about when they talk about hooks and filters, and just generally review the “behind the scenes” mechanics of how WordPress works. We’ll also touch on a few “tricks of the trade” that you might not realize are out there (version control, staging sites, caching, Vagrant, and other fun tools to make development with WordPress just a little bit easier).

This talk is aimed at designers and new developers who maybe have a few PHP tricks up their sleeves, but still haven’t figured out some of the details behind the scenes.

If you’ve never edited functions.php and don’t know what it is, this probably isn’t a good talk for you just yet. If you’ve written a plugin or modified several .php files in your WordPress themes, this talk will probably be a bit too basic for you. If you’ve set up a child theme before and know what functions.php is, even if you haven’t really used it all that much, or even at all…. you’re probably the exact person who will get a lot out of this talk. And if that’s you, you should be able to walk away with a solid mental model of how WordPress works “behind the scenes” and be in a much better position to do development with it

Ähnliche Bücher

Kostenlos mit einer 30-tägigen Testversion von Scribd

Alle anzeigen

Ähnliche Hörbücher

Kostenlos mit einer 30-tägigen Testversion von Scribd

Alle anzeigen
  • Als Erste(r) kommentieren

  • Gehören Sie zu den Ersten, denen das gefällt!

Everything You Always Wanted to Know About WordPress (but were afraid to ask)

  2. 2. WORDPRESS.ORG VS WORDPRESS.COM .COM VS .ORG ▸ Build your mental model around eating in at home vs eating out at a restaurant ▸ Eating at a restaurant: ▸ There’s not a ton of work involved to get your meal. ▸ They have menus. You can customize a few things about your meal. But you can’t customize everything. Your options are limited. ▸ But, there’s a good chance that the chef knows more about cooking than you do. And so there’s a decent chance your meal will turn out great, even if you can’t get everything you might want
  3. 3. WORDPRESS.ORG VS WORDPRESS.COM CONT. .COM VS .ORG CONT. ▸ Eating at home: ▸ You can do whatever you want. You are the only limit to your options. ▸ Depending on what you’re making, it might be cheaper to make it yourself. It might turn out better too. ▸ But, you have to do it yourself. Depending on what you’re trying to do, that could be really easy or really hard. ▸ Also, you may not be a very good cook whereas the chef at a restaurant probably is.
  4. 4. WORDPRESS.ORG VS WORDPRESS.COM CONT. .COM VS .ORG CONT. ▸ In this analogy, making your website on WordPress.com is kinda like getting dinner from a restaurant. ▸ You have to “order from the menu” in a sense and your options are limited. But in a lot of cases, that’s not a bad thing. ▸ Making your website on WordPress.org is kinda like making dinner in your kitchen. ▸ Your options are limitless. ▸ Some things are extremely easy to make. And some people are great at creating all manner of fantastic things on their own. ▸ But, you have to do a lot of the work yourself.
  5. 5. WHAT IS AN API AN API IS…. ▸ An application programming interface ▸ Build your mental model around soda machines. ▸ When you buy a soda from a soda machine, you are interacting with a machine via its software by utilizing an interface. ▸ When we’re talking about APIs, we’re talking about software that has an interface so that other software can interact with it. ▸ For example: the WordPress APIs https://codex.wordpress.org/ WordPress_APIs
  6. 6. WHAT IS (WEB) ACCESSIBILITY WEB ACCESSIBILITY IS….. ▸ Making sure that the web is not difficult or impossible for some people to use ▸ There are 20 million blind adults in the United States; eight percent of men are color blind; approximately 10 million Americans are hard of hearing and one million are deaf. ▸ When people talk about making the web accessible, they’re talking about the fact that this building we are standing in right now has elevators for people who need or want them. The web, by and large, does not.
  7. 7. WHAT IS WORDPRESS WORDPRESS IS… ▸ A database (with your posts, pages, some data about your users, some info about your website, etc) ▸ A bunch of PHP (functions.php, template files, etc) ▸ Some files on your server: CSS, JavaScript, images, and other files that are organized on your server in such a way that WordPress can find them, kind of like you organize the files on your own computer so that you can find them ▸ A bunch of rules and conventions about how all this stuff is supposed to work together <— This is key
  8. 8. WORDPRESS RULES / CONVENTIONS THE TEMPLATE HIERARCHY ▸ Every WordPress theme, at a minimum, has index.php and style.css ▸ A lot of WordPress themes have special page/post templates in addition to that ▸ Twenty Fifteen for example has templates for pages, posts, the 404 page, the archive… ▸ The Template Hierarchy is just a bunch of simple yes/no rules that associate your content (pages, posts) in the database with any number of templates on your fileserver.
  9. 9. MORE WORDPRESS RULES / CONVENTIONS HOOKS ▸ Hooks are likes Legos for your website’s codebase. They let you attach your own code to whatever WordPress is doing (ex: after the header prints, render a photo of a lolcat) ▸ There are two types of hooks in WordPress ACTIONS & FILTERS
  10. 10. WORDPRESS HOOKS: ACTIONS & FILTERS ▸ ACTIONS DO STUFF If a user clicks this button, print a message that says “You’re awesome!” When you publish a blog post, share the link and the title of that post on Twitter ▸ FILTERS MODIFY STUFF If the user is logged into your site, modify the message to say “You’re awesome, $current_user-> display_name”. Before you publish that post url and title to Twitter, shorten the url and rewrite the title to make it all fit under 140 characters ▸ Ideally, filters don’t actually do anything except take an input, modify it, and give it back to you (that is, they modify the message you want to send to Twitter, but they don’t actually send the message)
  11. 11. WORDPRESS AHA MOMENTS FIRST AHA MOMENT OF THE DAY FILTER HOOKS DON’T NECESSARILY FILTER THINGS *OUT* ▸ The point about filters is just that they take an input, modify it, and return it. ▸ It has nothing to do with filtering things out or returning less of something somehow SECOND AHA MOMENT OF THE DAY! FILTERS THAT DO STUFF ARE DANGEROUS ▸ A great example of this: http://ottopress.com/2011/actions-and-filters-are-not- the-same-thing
  12. 12. WHAT IS DOING DEVELOPMENT WITH WORDPRESS? ▸ If you printed a list of actions and filters in WordPress along with a one sentence description of what they are, you’d need about 50 pages to print them all out ▸ By the time you add the topic list on wp-config.php and the database API, you’re well over 100 pages BUT (HERE’S THE GOOD NEWS)
  14. 14. DOING DEVELOPMENT WITH WORDPRESS VARYING VAGRANT VAGRANTS ▸ https://github.com/Varying-Vagrant-Vagrants/VVV ▸ VVV is a way for you to run multiple copies and versions of WordPress on your laptop without having to fight with MAMP/WAMP/XAMPP etc ▸ It pretty much Just Works and lets you practice (for example) editing a PHP file on your local computer and immediately being able to see how it works in your browser ▸ It also behaves the same way that a real server would. If you’ve ever deployed code you tested on MAMP/WAMP/XAMPP and had it blow up in your face cause your server had a different version of PHP… you’ll love VVV ▸ You can also check out Chassis: http://docs.chassis.io/en/latest/
  15. 15. DOING DEVELOPMENT WITH WORDPRESS: WHAT NOW? WHAT NOW? ▸ Get VVV set up on your computer. ▸ Start with Fifteen Five and see if you can write a page template for any posts categorized as “dog.” ▸ Write an action hook that prints a message: “Hello dog lover” after the header whenever you’re on a post categorized as dog. See if you can do the same with some login in category-dog.php and with some logic in functions.php ▸ Write a filter hook that prints the user’s name after the message, if the user is logged in ▸ Read the settings in wp-config.php. Change a few of them. See what happens. ▸ Read the docs. Keep playing with the code. ▸ And if you run into something you don’t understand….don’t be afraid to ask :)