The Ringfree Learning Center is constructed using WordPress and, as such, uses most of its standard conventions when adding and editing content. Articles on this site are implemented as standard WordPress pages, but flagged by checking a box on the add/edit page. With a couple of exceptions, post formatting follows the standard WordPress conventions exactly. For a quick rundown on WordPress post formatting, please see the following links:
To add a new article, please observe the following steps:
- Access the dashboard by navigating to http://learn.ringfree.com/wp-admin
- Click on the Pages link on the left sidebar
- Click either of the Add New options (one is at the top of the page, the other is in the sidebar below the Pages option
- Enter a title for your page and your page content
- In the Article Settings box, check the box labeled This page is an article
- In the Public Access box, click to specify which user roles should be excluded from seeing the article
- In the Subjects box, select a subject relevant to the topic at hand or elect to add a new subject
- You may ignore the Page Attributes, Featured Image, and Admin Access boxes, optionally you may hide them completely using the Screen Options at the top right of the page
- Once you are satisfied you have the content, subject, and access restrictions set, click the blue Publish button located within the Publish box
To edit an existing article, follow the above steps with two exceptions:
- In step 3, instead of clicking Add New, select an existing article from the list.
- In step 9, the blue Publish button is replaced with a button labeled Update
There are a few formatting options that are more likely to be used when adding articles for this site than in a normal WordPress scenario. Namely the addition of commands, code, and text blocks.
In some cases you may want
inline monospaced text in order to show a value, an operational keyword, or some other reason. To do this, press and hold
Alt, and press
x to toggle inline monospaced text formatting. Additionally you may convert normal text to inline monospaced text by highlighting it and pressing the aforementioned key combination. Note that there is not a standard button within the WordPress editor for toggling this.
In other cases you may wish to display a monospaced text in a separate block, perhaps to display a command to execute or clearly display a value for end users to enter. For example:
To do this we can make use of an option called
Preformatted that’s available within the WordPress editor. To apply this, highlight the block of text you would like formatted in this way, and then select
Preformatted from the formatting dropdown at the top of the editor. There is one major quirk that you should be aware of with this type of formatting: be sure to add an extra line of white space after the block of text you intend to format. Pressing
Enter within the block after it has been formatted will simply create a new line within the block. Having an extra line of white space after gives you a place to pick up after you finish with the block.
The occasion may also arise when you need to add code snippets to an article. Using the above method works for this, but with the limitations of the syntax not being highlighted and it doesn’t handle new lines in a manner typically expected of code snippets on websites. To solve this, a shortcode has been implemented on this site. Let’s say, for example, that we want to embed a snippet of PHP code in the page such as:
<?php echo "Hello World!"; ?>
All we need to do is wrap the code snippet in the
code shortcode and pass the language as an argument. To illustrate with the above example:
[code lang="php"]<?php echo "Hello World!"; ?>[/code]
You may optionally omit the
lang argument, however doing so will result in the
code shortcode displaying identically to the
Preformatted option mentioned above. Most languages commonly used here at Ringfree are supported. If you find that a language you need is not supported, please inform Kendall and he’ll add it when he gets a chance.
The major quirk to inserting code snippets is that the standard WordPress editor (often referred to as the Visual Editor) is pretty bad about stripping whitespace. While the above works fantastically for a few lines of code, it’s substantially less effective when trying to post nested code such as functions, loops, and entire scripts. To post these, it’s advisable to use the WordPress Text Editor which retains whitespace.
The Text editor also comes with a quirk in that it evaluates HTML markup. Given that many programming languages have syntax that can also be evaluated as HTML, it’s advisable to run your code snippet through an HTML entity encoder prior to publishing it using the . There are numerous HTML entity encoders on the internet besides the one linked in the previous sentence so don’t feel like you have to use that particular one. Additionally there are plans to build an HTML entity encoder into the
code shortcode at some later point.
If you need to have quite a bit of standard text in addition to longer nested code snippets, the WordPress plugin Page Builder by SiteOrigin is installed and is ideally suited to handling these sorts of circumstances. To use Page Builder, consult SiteOrigin’s documentation or ask Kendall to show you how to use it.