Month: March 2018

  • The World Wide Web (defined)

    The World Wide Web, also known as the Web, is the part of the Internet that consists of structured text files, called web pages, that link to other web pages and digital files using hypertext links. Every page or file on the Web is identified by its Uniform Resource Locator (URL).

    Web pages are written in a structured markup language called HTML (HyperText Markup Language), a type of text file. These web pages are stored on a web server, a computer that shares web pages and linked files over the Internet. A collection of web pages on a web server is known as a website. Websites are most commonly identified by a unique domain name. You use a web browser, such as Firefox, to navigate and view these web pages stored on web sites.

    It’s a common mistake to think of the World Wide Web as the entire Internet, but the Web is in fact only part of the Internet, just the part that most people are familiar with and interact with the Web more than any other Internet protocol, including email.

    Before the invention of the World Wide Web and the web browsers needed to view and navigate the Web, people using the Internet encountered a text-only Internet. Since plain text is still the basic building block of information transmission on the Internet, you can still view everything on the Internet, including web pages, as text-only documents. But why do that when you can see colorful web pages with images, video, audio, and beautiful typography? That’s one of the reasons that the World Wide Web grew so fast.

    Read more about the World Wide Web on Wikipedia, and learn about the Web’s history, standards, and related technologies.

  • WordPress Post vs. Pages

    What’s the difference between a WordPress Post and a Page, and when should I use one instead of the other?

    As you build your WordPress site, you will use two main building blocks: Pages and Posts. When you are starting out, it can be very confusing to select which of these foundational elements to use when you want to add content to your site, because they are both very similar.

    Pages and posts both include:

    • A title
    • Content, usually text, but also may include media such as graphics and video
    • Features and attributes like comments, an author, settings, a slug, and a featured image.

    Also, in WordPress, pages and posts are both published (when you want them to appear on the Internet), or saved as a draft (when you want to save them but don’t want the public to see them yet). In short, it’s not very clear what the difference is between a page or a post is from a quick examination. But, if you dig a little deeper, you can begin to see the critical differences, and these differences will help you decide whether to use a page or a post when you add new content to your WordPress site.

    Where did posts (and WordPress) come from anyway?

    It’s important to remember that WordPress was originally built as a blogging tool (or platform). A Blog (short for web log) is a type of website that consists of discreet, text-based entries, or posts, that are typically organized in reverse chronological order. This means the latest or most recent entry is listed first, and earlier entries are listed below. Because WordPress started as a blogging tool, Posts were part of the earliest versions, but Pages were not.

    The blog approach to organizing web content proved very popular and intuitive. Because blogs tended to be informal and timely (meaning, focused on recent developments, like a newspaper), many blog readers wanted to comment on the content in a post. WordPress also supported reader comments from its earliest days. In this way, blogs became more of a conversational medium, a two-way back and forth between the publisher and the audience, instead of the more traditional broadcast model, where the publisher shares information in one direction, towards the audience.

    Blogs also popularized the idea of subscribing, where readers would receive a notice when new post were added to their favorite blogs. Blogs typically handled subscriptions using RSS  (real simple subscription) which rapidly became a standard and open way of distributing content over the Internet.

    As popular blogs grew in size and scope, publishers wanted to add the ability to organize their posts by categories, not just listing them in reverse chronological order. So, they started tagging their blog posts, so you could see all the posts related to a specific topic, regardless of when the post was originally published.

    To support features such as commenting, categories, tags, and RSS subscriptions, software developers created blogging software, such as WordPress, to make these features available to non-technical writers and publishers.

    As WordPress became more popular, many WordPress publishers wanted to add the ability to create pages, the original building block of older, static websites. Unlike blog posts, pages do not typically display by the date they were published, but are instead linked using menus and other hierarchical navigation systems. Pages are essentially simpler than posts, an earlier form of Internet content.

    Understanding the difference between pages and posts

    WordPress Posts:

    • Are organized in reverse chronological order
    • Also may be cross-referenced with Categories and Tags
    • Are often focused on information that is timely
    • Are intended to be shared with subscribers or followers using RSS or social media

    WordPress Pages:

    • Are organized with hierarchical menus
    • Present content that typically does not change over time
    • Do not include categories and tags

    Examples of pages and posts

    Here are some examples of the best uses of Pages and Posts for different types of content.

    Excellent uses of WordPress pages

    • About Us
    • FAQ (Frequently Asked Questions)
    • Contact Us
    • Our Team
    • Mission Statement

    Although it’s easy to edit and update pages in WordPress, typically the content on a page won’t change much over time. Also, the content of a page does not usually deal with timely material, such as press releases or news. These items are best handled as posts in WordPress.

    Excellent examples of WordPress posts

    • Press releases
    • News items
    • Product reviews
    • Event announcements
    • Photos and text documenting a recent event
    • What you had for lunch. Just kidding! No one cares what you had for lunch.

    Posts also may be shared through subscription services like RSS and social media. Since WordPress was originally a blogging platform, It’s usually best to add new material to your WordPress site as a post, after you’ve established the structure of your site with pages.

    WordPress, and posts in particular, support the idea that your website is constantly growing, that you are adding new and interesting material on a regular basis. Visitors to your site are typically not going to be interested in an update to the About Us page, but would more likely want to read a new post about an upcoming event or other current news items.

    Using Posts and Pages Together

    Once you have set up your site with the static pages that provide the background information you want to share with site visitors, most of the content you add to your website should probably be added as a post. Encourage visitors to subscribe to your RSS feed and add information about new posts to your social media feeds such as Twitter, Facebook, LinkedIn, and others. If you maintain an email subscriber list (an excellent and incredibly valuable strategy to build an online community, supporters or new customers) it’s best to first post the articles that you want your email subscribers to read on your site as blog posts. Then send out an email with brief descriptions of each article and the link back to your website.

    Once visitors reach your site, encourage them to post comments and interact with each other. Posts are typically better platforms for these kinds of discussions. We recommend that you monitor comments on your blog to improve the quality of the discussion. Also encourage visitors to share your posts on social media, like Facebook or Twitter. It’s a good idea to add those handy Share buttons at the bottom of your posts.

  • Virtual Machine (defined)

    A Virtual Machine (VM) is essentially a second computer that runs in the memory of your computer hardware, the host computer. This computer-within-a-computer runs on top of the operating system of the host computer, and therefore can be started and stopped just like any other application on the host computer. If software on the virtual machine misbehaves, and causes the virtual machine to crash, it’s simply a matter of restarting the virtual machine, while your host computer continues to run.

    Also, your VM may run a completely different operating system from the host machine. You could, for example, run a Windows or Linux virtual machine on a Macintosh. Since VMs share the hardware resources of the host computer, VMs run best on host computers that have copious amounts of RAM, disk space, and powerful CPUs.

    Web developers use VMs to:

    • Build and test web sites on a virtual web server on their own local development computer.
    • Test a website from browsers running on different operating systems installed on different virtual machines, all on the same host computer.
    • Run multiple web servers on a single physical computer.

    More Information about Virtual Machines

    From the Virtual machine article on Wikipedia:

    There are different kinds of virtual machines, each with different functions:

    Virtual Machines – Wikipedia
    • System virtual machines (also termed full virtualization VMs) provide a substitute for a real machine. They provide functionality needed to execute entire operating systems. A hypervisor uses native execution to share and manage hardware, allowing for multiple environments which are isolated from one another, yet exist on the same physical machine. Modern hypervisors use hardware-assisted virtualization, virtualization-specific hardware, primarily from the host CPUs.
    • Process virtual machines are designed to execute computer programs in a platform-independent environment.
  • The VVV WordPress development environment: set it up on your computer

    The VVV WordPress development environment runs on your local development computer in a virtual machine (VM) so you don’t need to connect to a remote server to build your WordPress site.

    Varying Vagrant Vagrants, or VVV, is an open source project that runs on all major operating systems, including Windows, Mac, and Linux computers.

    Because VVV is a WordPress development environment that runs locally on a virtual machine (VM), there’s no network lag as you wait for your changes to be saved to the remote server … and then wait again to reload your pages to check your work. You don’t need a remote staging or production server to start creating your WordPress site.

    It also means you can develop your WordPress site without a direct connection to the Internet — although you’ll want to set everything up first while you are still online.

    VVV also works great with Git, to help manage you codebase and share your code with other team members.

    How does the VVV development environment work?

    VVV helps you configure new virtual WordPress servers quickly, so you can set up multiple WordPress VM local development environments on your computer easily.

    VVV needs two other components to work:

    • Vagrant
    • A Virtual Machine (VM)

    Vagrant is free, automated open source tool from HashiCorp for building and managing virtual machine (VM) environments. Since maintaining a virtual machine is at least as difficult as maintaining an actual computer, anything that you can do to simplify this process will make a huge difference in your productivity.

    To use Vagrant, you’ll also need to use a virtual machine environment (VM). VVV recommends that you use Oracle’s free Open Source VM VirtualBox.

    Get started with the VVV WordPress development environment

    To use VVV effectively, you’ll need:

    • a computer with a decent amount of RAM (at least 8 GB, but 16 GB or more is ideal).
    • a modern CPU that supports virtualization.
    • an SSD drive is optional, but recommended.
    • depending on the size of the websites you’re developing, you’ll probably want copious storage space.

    Install VVV

    Use the menu on the right side of the VVV website to complete the steps under the headings

    Once you’ve installed VVV, you’ll find a vagrant-local folder in your home (or user) folder. This folder contains all of the files the VVV web server uses to set up your development sites. You can access and edit these files any time, even if VVV isn’t running.

    Set up HTTPS

    This means you can connect to your local development site like this: https://example.com – especially handy when WordPress automatically generates links as you add menus, pages and posts.

    To set up HTTPS on your VVV development machine, follow the instructions for Setting Up HTTPS on the VVV site.

    TL;DR: add tls-ca to the core section of your vvv-custom.yml file and reprovision VVV with vagrant reload --provision

    Version 3 of VVV already includes this tls-ca addition the core section of your default vvv-custom.yml file, so you can use the https: protocol right away.

    Note that earlier versions of Firefox did not accept a self-generated certificate of the kind used by VVV.

    Now, you can also use Firefox to test your site on VVV using https connections — as with Google Chrome and Safari, warnings appear, but you can choose to proceed.

    Testing your new VVV local VM development environment

    If everything is working, this page displays a list of the active websites on your VVV installation, plus some other handy links to the tools installed on VVV, like:

    • phpMyAdmin
    • phpMemcachedAdmin
    • Opcache Status
    • MailHog
    • Webgrind
    • PHP Info
    • PHP Status

    Plus many more — see the VVV Software Packages section below for a complete list.

    Set up VVV WordPress websites

    This setup process essentially consists of adding a new site section to your vvv-custom.yml file, and then reprovisioning VVV with vagrant reload --provision

    Other VM development considerations

    • Back up your databases while your VM is running! Your updated WordPress database only exists in the VM. Use the included phpMyAdmin or WP-CLI to back up your database(s).
    • Always remember to exit VVV with vagrant halt to free up the RAM your virtual server uses, and to restore your host file to its original state.
    • Back up your development files in your vagrant-local folder on your development computer. One great backup option: use Git to place your code under version control.

    Working with SSH and WP-CLI in VVV

    • If you need WP CLI or PHP Codesniffer, or want to administer your virtual machine from the command line, run vagrant ssh (no password required). This drops you in the /home/vagrant user directory on the VM.
    • VVV maps the ~/vagrant-local/www folder on your development computer to /srv/www in the virtual machine. Simply enter cd /srv/www after you log into VVV with ssh to work directly with these files via SSH.
    • In the /srv/www directory, enter ls to see a list of all the sites that are set up in VVV.
    • Use the cd command to open a site directory. Once you’ve entered a site directory, you can use WP-CLI to administer that specific site.
    • When you’re done using SSH on your VVV machine, enter exit to log off of the VM and exit SSH.

    More Info on VVV

    Detailed information about VVV.

    VVV Software Packages

    1. Ubuntu 18.04 LTS (Bionic Beaver)
    2. WordPress Develop
    3. WordPress Stable
    4. WP-CLI (master branch)
    5. nginx (mainline version)
    6. MariaDB 10.1
    7. php-fpm 7.2.x
    8. memcached
    9. PHP memcache extension
    10. PHP xdebug extension
    11. PHP imagick extension
    12. PHPUnit
    13. ack-grep
    14. git
    15. subversion
    16. ngrep
    17. dos2unix
    18. Composer
    19. phpMemcachedAdmin
    20. phpMyAdmin (multi-language)
    21. Opcache Status
    22. Webgrind
    23. NodeJs
    24. grunt-cli
    25. Mailcatcher

    — from What is VVV? | Varying Vagrant Vagrants

    Relative and Absolute Hyperlinks

    The relative path replaces the protocol and domain with a single slash character (“/”). The absolute path to this article, for example, is https://cadent.net/use-vvv-as-a-wordpress-dev-environment/ and the relative path to this article is /use-vvv-as-a-wordpress-dev-environment/.

  • Use vv to set up a new WordPress installation in VVV

    The vv script is no longer maintained, and this page is currently preserved for historical purposes. From the vv GitHub repo:

    This project is no longer maintained. Please update your copy of VVV , which has most of the vv features built in.

    from bradp/vv: Variable VVV – a VVV Site Creation Wizard.

    So many V’s! vv is short for Variable VVV, a VVV site setup wizard command line tool, automating the process of creating a WordPress installation in VVV. If you’re not comfortable working with the command line, this tool probably isn’t for you. But if you want to Use Varying Vagrant Vagrants (VVV) as a WordPress Development Environment, using vv to set up your virtual WordPress websites is incredibly handy and makes it much easier to automate common VVV website creation and maintenance tasks.

    The following instructions assume you know how to execute commands on the command line, using your computer’s Terminal or Command application. You also need to install VVV — see Using VVV for details.

    To get started, install vv. I prefer the git installation for my Mac development computer, but you can also use Homebrew. Follow the installation instructions for your OS.

    Using vv

    Once vv is installed, you can list the sites that are currently configured in VVV:

    vv list

    Create a new VVV WordPress site with vv

    To create your new VVV WordPress site, use vv create, like this:

    vv create -d example.com -n example

    Replace “example.com” with your production server domain for the -d(omain) parameter, and replace “example” with your domain root for the -n(ame) parameter. Or use the more readable version:

    vv create --domain example.com --name example

    When you run this command, you’ll need to answer a number of questions. If this is your first site you’re setting up with vv, the default options should work just fine.

    After vv provisions your new site, you need to complete one more step: Update the vvv-custom.yml configuration file to add the host entry for your new WordPress installation.

    First, make a clean exit from VVV:

    vagrant halt

    Then, open the vvv-custom.yml file in your favorite text editor. On my Mac, this file is located in ~/vagrant-local/vvv-custom.yml.

    Scroll down and locate sites: (or use Find) and then add your new site as follows:

    sites:
     example:
       hosts:
         - example.com
         - www.example.com
    
    # Tip: add a blank line after your list of hosts

    Important: don’t use tabs to indent the entries! You must use spaces only or VVV will cough up an error message when you try to reload it (this is a requirement of the YAML file format).

    Save vvv-custom.yml and re-provision vvv:

    vagrant reload --provision

    Now, open your favorite browser, open an incognito or private window, and enter the domain you just created. Your new website should appear, with a generic WordPress installation. To log in to the WordPress dashboard, browse to:

    example.com/wp-admin

    and enter the admin account that vv created:

    • username: admin
    • password: password

    Obviously, you’ll want to change this before your site goes live!

    Now you have a virtual WordPress server that’s available any time you run VVV on your, and goes away whenever you halt VVV (but is still stored on your local drive).

    Delete VVV WordPress sites with vv

    VV can also delete sites. Deleting a website with VV is simple:

    vv delete site_name

    Don’t know the site name? Use:

    vv list

    If you delete a site using VV, remember that you’ll still need to edit the vvv-custom.yml configuration file manually to remove the host entry for the WordPress installation you just deleted. If you deleted a site so that you can install a new, clean version, just leave the entry in vvv-custom.yml and recreate the site with the vv create command.

    Advanced vv features

    One of the biggest advantages of using vv is automating common website deployment tasks with VVV. These advanced automation features let you:

    Check the list of vv Options and Commands to see a comprehensive listing of everything you can do with vv to automate site maintenance with VVV.