Skip to main content
  1. All Posts/

vanilla-wp

Tools Open Source PHP WordPress

WordPress Vanilla Boilerplate

WordPress boilerplate for vanilla WordPress installations with modern development Tools (Docker, WP CLI, PHPCS).

Quick Links

Features

Gaambos Vanilla WP takes vanilla WordPress and enhances it through the following features:

Requirements

Installation

  1. Create a new project
    Clone git repository

    $ git clone git@github.com:gaambo/vanilla-wp.git website-dir
    $ cd website-dir && rm -rf .git
    $ git init
  2. Set file Permissions (when on WSL2 or Linux)
    1. Choose which user should WordPress/the server run as and you want to edit the files (in most cases it’s your user)
    2. Create a .env file in the root directory to set the the user
      DOCKER_USER=0 # output from $(id -u)
      DOCKER_USER_GROUP=0 # output from $(id -g)
    3.   <li>
          Ensure the project-folder (and public) belong to this user <pre>   chown -R 1000:1000 ./public</pre>
        </li>
      </ol>
      
      <p>
        More Information </li> 
        
        <li>
          Start Docker containers <pre>docker-compose -f "docker.compose.development.yml" up -d --build</pre>
        </li>
        
        <li>
          Install WordPress (See Wiki) <pre>$ .utilwpcli.bat core download --path='./public'</pre>
          
          <p>
            Then run <code>.utilwpcli.bat core install</code> with the <a rel="nofollow noopener" target="_blank" href="https://developer.wordpress.org/cli/commands/core/install/">according arguments</a> or just open up the website in your browser to start WordPress famous 5 minute installation.</li> 
            
            <li>
              Install dependencies <pre>$ composer install</pre>
            </li>
            
            <li>
              Install Theme<br /> My _g Theme works perfectly with this boilerplate. I suggest you use this one:</p> <pre>$ cd public/wp-content/themes/${themename}
      

      $ git clone git@github.com:gaambo/_g-wp-theme.git . $ rm -rf .git $ npm install $ composer install

              <p>
                Then exclude the path in gitignore: <code>!public/wp-content/themes/${themename}</code> </li> </ol> 
                
                <p>
                  All other themes can be installed as usual (unzip in public/wp-content/themes, upload via FTP,&#8230;). You can also use wpcli:
                </p>
                
                <pre>$ ./util/wpcli.sh plugin theme twentynineteen</pre>
                
                <ol start="6" dir="auto">
                  <li>
                    Install Core Functionality Plugin (optional)<br /> My Core Functionality Plugin works perfectly with this boilerplate. I suggst you use it to for complete site-projects to put all site-specific functionality in it:</p> <pre>$ git clone git@github.com:gaambo/wp-core-functionality-plugin.git public/wp-content/mu-plugins/core-functionality
      

      $ rm -rf .git

                    <p>
                      Then exclude the path in gitignore: <code>!public/wp-content/mu-plugins/core-functionality</code> </li> 
                      
                      <li>
                        Install plugins: <pre>$ ./util/wpcli.sh plugin install autodescription</pre>
                      </li>
                      
                      <li>
                        If developing a custom theme or plugin which you want to include in the repository exclude it in <code>.gitignore</code>.
                      </li>
                      <li>
                        If developing a custom theme or plugin which you want to have PHP linting available include it in <code>phpcs.xml</code> via <code>&lt;include-pattern&gt;PATH&lt;/include-pattern&gt;</code>.
                      </li>
                      <li>
                        Set the document root on your webserver to the public folder: <code>/path/to/site/public/</code>
                      </li>
                      <li>
                        Access WordPress admin at <code>https://example.com/wp-admin/</code>
                      </li></ol> 
                      
                      <h2 dir="auto">
                        <a rel="nofollow noopener" target="_blank" id="user-content-deployment" class="anchor" aria-hidden="true" href="#deployment"></a>Deployment
                      </h2>
                      
                      <p>
                        <a rel="nofollow noopener" target="_blank" href="https://deployer.org/">PHP Deployer</a> in conjunction with gaambos WordPress recipes is used. A documentation of all available tasks can be found in the <code>README.md</code> of the package. The <code>deploy.php</code> is based on the default/vanilla deploy recipe from this package and edits localhost settings for setting document root and using Docker for WP CLI.<br /> Before running any tasks you have to configure SSH acces to the hosts defined in <code>util/hosts.yml</code> via <code>~/.ssh/config</code>.<br /> Run scripts in <code>scripts</code> dir via <code>.utilwpcli.bat eval-file ./scripts/roles-capabilities.php</code> (on server).
                      </p>
                      
                      <h2 dir="auto">
                        <a rel="nofollow noopener" target="_blank" id="user-content-documentation" class="anchor" aria-hidden="true" href="#documentation"></a>Documentation
                      </h2>
                      
                      <p>
                        Documentation can be found in our GitHub wiki
                      </p>
                      
                      <h2 dir="auto">
                        <a rel="nofollow noopener" target="_blank" id="user-content-contributing" class="anchor" aria-hidden="true" href="#contributing"></a>Contributing
                      </h2>
                      
                      <p>
                        Contributions are welcome from everyone. Just open an issue or contact me.
                      </p>