WordPress (Business Tool)

Table of contents

Child pages

Related pages

Learning WordPress

General resources

How it works "under the hood"

  • 2017.11.03 - Coast Digital - Learning How WordPress Works Under the Hood
    • Intro

      • To understand how WordPress works, you need to know how the data that powers a WordPress site is stored and how it’s used. Data is stored in different categories, with the main four of them being split down further into two. The four main categories of data are:

        • Posts

        • Comments

        • Users

        • Terms

      • Each of those four categories are then split into core data and meta data.
    • Posts
      • This is kind of confusing. So, there are two ways that the word "post" is used in WordPress. The first way is to refer to the typical blog posts that you associate with WordPress. But it's also used in a sense that's closer to "content" or "resource" when referring to the ability to create "Custom Post Types (CPT)". In this latter sense, the WordPress "Post", "Page", "Attachment", "Revision", "Navigation Menu", "Custom CSS", and "Changesets" are all "posts" (Custom Post Types).
      • CPTs have a selection of options that are always available, unless you explicitly wish to turn them off. These include but aren’t limited to a post title, content, slug (the URL of the page), template.
      • Apparently any Custom Post Type you create will show up in the dashboard on that left-side menu. I don't understand why I don't see an "Attachment" option (or any of the other default Custom Post Types other than "Post" and "Page") in my blog's dashboard, though.
    • Comments
      • Comments are more straightforward. They're always attached to a post and have six fundamental bits of data. The post it relates to, the author’s name, email address, website and the comment itself.
    • Users
      • Users have permissions to perform certain actions based on their "Roles" and the "Capabilities" that make up those roles. A user can have multiple "Roles".
    • Terms and Taxonomies
      • Terms
        • Terms are used to categorize posts. Terms are defined as one of two options. They are either hierarchical or non-hierarchical. The difference between the two can be distinguished by looking at how categories and tags work for the standard ‘Post’ type (regular blog articles). A post can have lots of tags, such as food, drink, cooking and kitchen but should only have one or two categories which can be nested.
      • Taxonomies
        • Taxonomies are collections of custom terms used for Custom Post Types. Let’s say you have a CPT defined as Recipes, which are guides you’ve written on how to create a variety of dishes. To categorise these recipes properly, you define a custom taxonomy called Cooking Types. Cooking Types is the taxonomy (the collection) and the individual Cooking Types such as Baking, Decorating and Roasting are the terms.
      • Terms are linked to taxonomies, and taxonomies are linked to CPTs.
    • Understanding WordPress further
      • Without diving deep into the code itself, there’s not a huge amount left to know about WordPress and how it all works behind the scenes.

Post Types

wp-content

  • 2017.09.28 - Elegant Themes - wp-content – A Beginner’s Guide to WordPress’ Most Important Directory
    • Intro
      • wp-content is "one of the most central parts" of the WordPress file structure
    • How to Access wp-content
      • It's in the root directory of your WordPress installation.
      • Use an FTP client like Filezilla to access it.
    • What is the Purpose of wp-content?
      • wp-content contains all user-supplied content. Basically anything you can upload to your site ends up here. That doesn’t include anything you write, mind you. Those things are stored in the WordPress database.

      • However, as long as you have both the database and your wp-content folder, you can always get your site back, even if everything else was lost.

      • The three root files / folders the author says are necessary to create a full back-up are: wp-content (folder), .htaccess (file), and wp-config.php (file).
    • So, What Exactly is Inside wp-content Then?
      • Standard Directories of wp-content
        • Plugins — As you can infer from the name, this is the place where WordPress stores plugins.
        • Themes — Similar to the plugins folder but for themes.
        • Uploads —- This is where WordPress stores all your media, like images, videos or other files you upload to your site.
      • Other Common Folders
        • mu-plugins — This is short for must-use plugins. Must-use plugins come with some themes and are crucial to make your theme and site work.
        • Languages — In case your site does not use English but one of the many other languages the CMS is available in, WordPress will save the language files inside this directory.
        • Upgrade — This is a temporary folder created by WordPress while upgrading your site to a new version.
      • Aside from that, other plugins might sometimes create their own directories inside wp-content.
    • When to Use wp-content
      • Fix Important Errors
        • The content of wp-content can sometimes be the cause of common WordPress errors. Specifically those caused by plugins and themes. When that happens and your site becomes inaccessible, you might have to access the plugin folder to deactivate some of them manually and get back into WordPress backend.

      • Rename wp-content
        • Despite its vital function, the name of wp-content is not set in stone. It’s entirely possible to change it to something else. Because WordPress is open source, anyone can figure out the basic structure of any site. The standard setup of WordPress is common knowledge, which makes it easier to start an attack. For that reason, renaming wp-content is one step towards a safer site.

    • wp-content in a Nutshell
      • wp-content houses any content provided by users that is not saved in the database. That includes plugins, themes and uploaded media.

The database

Taxonomies

Advanced info on the major plugins

ACF / Advanced Custom Fields

WooCommerce

Image handling

Creating Plugins

  • WordPress Codex - Writing a Plugin
  • WordPress Codex - Plugin API
    • Hooks are provided by WordPress to allow your plugin to 'hook into' the rest of WordPress; that is, to call functions in your plugin at specific times, and thereby set your plugin in motion. There are two kinds of hooks:

      • Actions

      • Filters

    • You can sometimes accomplish the same goal with either an action or a filter. For example, if you want your plugin to change the text of a post, you might add an action function to publish_post (so the post is modified as it is saved to the database), or a filter function to the_content (so the post is modified as it is displayed in the browser screen).
    • Actions

      • Actions are triggered by specific events that take place in WordPress, such as publishing a post, changing themes, or displaying an administration screen. An Action is a custom PHP function defined in your plugin (or theme) and hooked, i.e. set to respond, to some of these events. Actions usually do one or more of the following:

        • Modify database data.

        • Send an email message.

        • Modify the generated administration screen or front-end page sent to a user browser.

      • The basic steps to make this happen (described in more detail below) are:

        • Create a PHP function that should execute when a specific WordPress event occurs, in your plugin file.

        • Hook this function to the event by using the add_action() function.

        • Put your PHP function in a plugin file, and activate it.


    • Filters
      • Filters are functions that WordPress passes data through, at certain points in execution, just before taking some action with the data (such as adding it to the database or sending it to the browser screen). Filters sit between the database and the browser (when WordPress is generating pages), and between the browser and the database (when WordPress is adding new posts and comments to the database); most input and output in WordPress passes through at least one filter. WordPress does some filtering by default, and your plugin can add its own filtering.

      • The basic steps to add your own filters to WordPress (described in more detail below) are:

        • Create the PHP function that filters the data.

        • Hook to the filter in WordPress, by calling add_filter().

        • Put your PHP function in a plugin file, and activate it.

Actions

Tasks

  • Remove the sidebar when the user is on mobile.

Themes

Plugins

My thoughts on how to lay out and style the blog

Fonts

  • I like the styling that Confluence uses: links are not underlined when just looking at the webpage, but when you hover them the underline shows up.
    • Medium has underlining by default and no changes on hover except for the cursor changing.
      • How do they visually distinguish between underlined text and links?
    • The Journalist WP theme underlines by default, and then switches to a red color on hover.
    • RPS never underlines, has a red color for links, and switches to a very light-blue (almost white) on hover.
    • Pieter Levels underlines on hover but not by default, and never changes the color (it's a teal color)
    • Google search results are always blue, and underlined only on hover.

Landing page

Should there be posts listed in the sidebar?

  • I think maybe only if the posts have pictures or are placed at the bottom of a blog post...? I've noticed while reading articles for the NYT that their "highest-rated posts" tend to be further-down on the page, so you see them once you're already most of the way through the article that you're reading.
  • Medium has a very clean view when reading: nothing on the sides to distract you. But they do recommend articles at the bottom once you've finished reading.
  • The NYT recommends articles without 

Should I have an image at the top?

  • Preliminary answer: if you can use it like Pieter Levels does, to introduce who you are and what the reader can expect on the blog, then it could be a good idea. If you just have a generic image and no in-depth explanation, then it may not be a good idea.
  • Pieter Levels has an intro-style top, but he actually has a paragraph-long explanation of who he is, not just an image.
    • I think that explanation-text is probably the same as the section where I say "My thoughts on time-dependent work-related topics."
  • Tom Francis does not have a big image. He uses the RPS style.
  • Question to answer: Does that image pop up every time someone navigates to the page? Or only when 

What constraints are there on the image at the top?

  • As of this writing, the image is supposed to be 2000x1200.
  • To keep the blog loading fast, it's probably best to keep the file size around 100kb.
    • The example image (potted plant) is a 112kb jpeg.
  • Jpeg images are smaller when most of the image is blurry (Source), so to keep the image from looking like crap when it's compressed down to 100kb, most of the image needs to be out-of-focus, with just a small section that's in-focus.
    • This is how the example image is done.
    • I tried an image that showed a close-up of a row of books, all in-focus, and it looked terrible at 100kb.
  • When viewing the blog on a mobile phone, the image is cropped (towards the center?), and so you need to account for how that will look.
    • The example image looks great both on desktop and on mobile.

Sidebar

  • 2016.08.22 - I removed the 'Recent posts' and 'Meta' sections of the side-bar because I don't think they'll be helpful to most users.
    • The 'Meta' section is only used by the admin (me). So it's just a total distraction to anyone else who would come across my blog.
    • The 'Recent posts' side-bar section seems irrelevant because people can just scroll through my history. That's what I do when I'm browsing RockPaperShotgun.
Images
  • Format to use
    • RPS uses 280x112
    • Tom Francis uses 178x60
  • Having images alongside the posts
    • "Recent Posts Widget With Thumbnails" doesn't seem to allow for having the thumbnails above the accompanying text as of August 2017, because the image and title are both within a single <a> tag.