Tag: Theme Review

  • Learning WordPress Themes from Scratch

    Here’s the challenge for the class:

    • Create a repo on Github.
    • Create a WordPress theme from scratch.

    During the six hour lesson files, such as:

    • functions.php
    • header.php
    • footer.php
    • style.css
    • index.php

    was presented one by one. The students had to create their own version of a WordPress theme on Github.

    As far as I could see there were five – six groupings in the class.Some students were able to create a WordPress theme, like:

    Some groups, however, found that the task was too difficult. I asked them, what was difficult, and got very honest feedback, like:

    • “We don’t understand the purpose of PHP.”
    • “Why can’t I see my localhost site online?”

    On Github I could see, that some students didn’t understand the concept of includes. So there was some truth in the utterance: “We don’t know what PHP is“. In fact the problem was deeper than that.

    Some 2nd semester students did not understand the basic structure of a HTML document. It was clear that at least some of them did not know which tags belonged to the head section, or the body section.

    When I reviewed the code from some groups, it was clear, that thy didn’t understand the concept of includes, like get_header() og get_footer(). The idea of partials was not understood, so the basic contruction of the WordPress theme was not understood at all.

    One or two students tried to develop the theme on say the desktop folder. Of course this approach wasn’t a success. I tried to help them moving the files to /wp-content/themes/

    I asked the students to share code and work together on Github. They used Gitkraken as a GUI. Some groups could do it. Other groups did not get the concept at all. However most groups were able to share and edit code in a previous lesson.

    Before you attempt to develop WordPress themes in the classroom make sure that the students have a basic understanding of concepts such as the structure of a HTML document.

    Also I have an eery feeling, that at least some students need a better understanding of:

    • Operative systems.
    • The difference between own files and files online.
    • Where the files are (the concept of directories)
    • That the ../htdocs folder has other functions than say the Desktop on a localhost
    • What Xampp, Mamp or similar does.

    Now here is the real didactic challenge. If the problem is a poor understanding of operative systems, localhost servers and PHP that’s where we have to put the efforts in the classroom.

    So it was agreed, that the class should be divided in two large groups:

    • Basic code understanding
    • WP theme developers
  • phpcs for WordPress

    PHP Code sniffer is a code validator. In the tutorial: “Using PHP CodeSniffer With WordPress: Installing and Using the WordPress Rules” Tom McFarlin explains how to install the codesniffer with WordPress-specific sniffs.

    Then Tom McFarlin gives a demo on a phpcs on the plugin Hello Dolly:


    phpcs --standard=WordPress hello-dolly

    I have installed the sniffer following the suggestions in McFarlin’s tutorial on a LAMP server with WordPress. So the tool’s in the box.

  • Code Sniffer

    Entered the theme review theme on make.wordpress.org. Today a lot of software was installed:

    • Virtualbox (for a linux sandbox for WordPress)
    • Installed the recommended bugtragging plugins in the sandbox.

    Then I read the extensive documentation on coding standards, and the things a theme reviewer should look at.

    The codesniffer gave some problems. The recipe found here worked.  The documentation in a zip-file on Slack missed many practical details. And so did the page on Github with the codesniffer code.

    First phpcs was installed via apt-get. The next steps are contained in this shell history dump:

    2010  phpcs --standard=WordPress wp-config.php
     2011  pear
     2012  phpcs --standard=WordPress wp-config.php
     2013  sudo pear channel-update pear.php.net
     2014  pear upgrade-all
     2015  phpcs --standard=WordPress wp-config.php
     2016  pear install wordpress
     2017  composer create-project wp-coding-standards/wpcs:dev-master --no-dev
     2018  sudo apt-get install composer
     2019  composer create-project wp-coding-standards/wpcs:dev-master --no-dev
     2020  phpcs --standard=WordPress wp-config.php
     2021  phpcs --config-set installed_paths wpcs
     2022  sudo phpcs --config-set installed_paths wpcs
     2023  phpcs -i
     2024  phpcs --standard=WordPress wp-config.php
    
Enable Notifications OK No thanks

We use cookies - more information

Multimusen.dk will set a few cookies from Doubleclick, Google and the Social Media plugins they ay set some cookies. Some of my pages use APIs - such as YouTube, LinkedIn, Google Fonts, Google Maps, Mapbox, Spotify, Jetpack, Twitter, Facebook &c.. Such plugins may set the odd cookie.

Close