Teach WordPress Coding Best Practice. Focus on good WordPress code, with semantic markup and WordPress. The principles in the lesson are valid for all code. As a sample the class will code a plugin with a "Hello World" shortcode. The plugins can display an image, and the text strings will be translation ready.
The intended target group is undergraduates, with:
- Basic knowledge of HTML5.
- CSS3.
- JavaScript, and
- PHP
The students should have at least some knowledge about the topics listed above. They don't have to know each and every detail.
- How to plan the markup for a custom WordPress loop?
- How to add the WordPress PHP snippets, like the_author() etc.
- How to comment on your markup and your PHP.
- Learn to write readable, and beautiful code.
- Link correctly to images.
- Make translation ready text strings.
- Knowledge of best practice.
A bulleted list of linked files/materials the instructor needs to teach the module.
- Links to download files
- ( Files on github, coming here )
More about WordPress coding standards:
- WordPress Coding Standards. ( A behemoth of information )
In order to complete this lesson you need:
- A local server with Apache, MySQL, and PHP ( read: Xampp, Wamp, Mamp, Lamp or similar )
- Is your server up and running? ( try: http://localhost/ )
- Open WordPress in a browser: http://localhost/wordpress ( or whatever localhost address you've used )
If WordPress is up and running it's ok. If not:
- Check that Xampp or similar is on.
- Check that Apache is running.
- Check that MySQL is running.
- Try to load http://localhost/wordpress again.
Mac, Unix and Linux users should make sure, that the wp-config folder is read-and-writable for _everyone. _Otherwise you may not be able to edit your files, or install themes and plugins. I you don't know whether you can read / write or not, try this: open ../wp-config/plugins/ and create a file, give it the name z.txt or similar. If you're allowed to create the file, it's ok. Since you probably don't want the file any more, delete it again. If you can't create the file, check the folder settings.
A bulleted list of any handy tips or information for the instructor.
- In general students with Mac computers have difficulties wih read-write-permissions.
- Go to the students with a Mac, and make sure that the folder wp-config is readable and writable.
- Also make sure that all the permissions are redundant ( i.e. the permissions must be valid for all files and folders inside wp-config ).
The lesson, written in script form with screenshots and live demo instructions to be used by the instructor in a live classroom/workshop setting.
You will likely need to break down the walkthrough into sections.
These are short or specific activities that test an understand and help you practice certain components of the lesson. They should not be fully scripted exercises, but rather something that you would do on your own. For example, you can create an exercise based on one step of the hands-on walkthrough. Exercise name Short description of what the exercise does and what skills or knowledge it reinforces.
- Short point or step of the exercise
- And another.
A short quiz for students to evaluate their retention of the material presented. Write out the question.
- Option
- Option
- Option
- Option
Answer: 3. Correct answer
What is the best way to use else if condition.
- else if
- if else
- elseif
Answer: 3. Correct answer because else if is not compatible with the colon syntax for if|elseif blocks. For this reason, use elseif for conditionals.
How to create dynamic image path in WordPress theme files?
Answer: 1.