Skip to content

Instantly share code, notes, and snippets.

@kiriaze
Last active August 1, 2018 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiriaze/9fc0d101651326dac67c to your computer and use it in GitHub Desktop.
Save kiriaze/9fc0d101651326dac67c to your computer and use it in GitHub Desktop.
Presto README

Presto - Fast Local Wordpress Development

Composer backed project for easy WordPress sites.

Used to depend on the Simple Framework.

Learn more about Simple and its components or skip to the good stuff

  • Simple ( parent framework )
  • Simple Child ( child framework )
  • VVV Simple ( an alternative to Presto, if you have vagrant setup, run this instead, a one click solution so to speak )

Requirements


Optional ( But highly encouraged.. )

Want your mac to dev fly shit all day? check it homie.


Assumptions

You have a similar setup to the link above.


Consists of

  1. Latest WordPress
  2. Composer
    • themes - Simple Framework/Child (optional)
    • plugins
      1. See full list within composer.json and Readme files.
    • .htaccess ( Currently ignored from repo )
      1. permalinks
      2. media redirection to remote
    • project repo should also house a db dump

Installation

  1. Clone repo ( with submods if present ) and run composer.
$ git clone --recursive https://raw.github.com/kiriaze/PressPlay {Project-Name}
$ cd {Project-Name}
$ composer install
  1. Run ghost. ( Optional, sqlite instead - skip to #8 )
    • ( Follow instructions through cli )
curl -s https://raw.githubusercontent.com/kiriaze/ghost/master/ghost.sh > /tmp; bash /tmp/ghost
  1. Create your database. ( Or use SequelPro / Also optional )
# Default
$ mysql -u {username} -p {password} -e "create database {databasename};"
# If dev env setup with mac-dev-env/homebrew, use the line below instead
$ mysql -u root -p  -e "create database foo;"
  1. Update git remote in root of project and subsequent files.
# Remove git from root of your project
$ rm -rf {Project-Name}/.git
# Add your new remote to the root of your project
$ git remote add origin https://path-to-repo.com/repo.git
# Remove git from project theme
$ rm -rf {Project-Name}/wp-content/themes/{project-theme}/.git
  1. Update Naming Conventions

    • Rename Simple-child to {Project-Name} ( Or Simple-Framwork depending on which you choose to use )

    • Update wp-content/themes/{Project-Name}/style.css naming refs, and should reflect the code block below.

      /*
      Theme Name:  	Project Name
      Theme URI:  	http://projectname.com
      Author:  		Project Author
      Author URI:  	http://projectauthor.com
      Description:  	An awesome description.
      Template:       simple
      Version:  		1.0.0
      License: 		GNU General Public License v2 or later
      License URI: 	http://www.gnu.org/licenses/gpl-2.0.html
      Text Domain: 	simple
      */
      
    • Update wp-content/themes/{Project-Name}/assets/js/app.js naming refs

      # Update all THEMENAME/SHORTNAME refs within file
      # THEMENAME is the full name of your project, e.g. MyAwesomeProject
      # SHORTNAME is the acronym of the THEMENAME, e.g. MAP
      var SHORTNAME = window.THEMENAME; // example before
      var MAP = window.MyAwesomeProject; // example after
      
  2. Set permissions to project directory ( WP Updates Specific )

$ sudo chown -R _www {Project-Name}
$ sudo chmod -R g+w {Project-Name}
  1. Update wp-config.php credentials to connect to your db.
  2. Direct browser to {Project-Name}.dev/admin
  3. Make dope shit yo.

Notes:

  • When updating gitignore, run $ git rm -r --cached . then re add/commit

  • Add acf-pro license into wp admin.

  • If you add other plugins to your project, you have two options to keep them in sync.

    • Exclude from .gitignore with !wp-content/plugins/{plugin-name}
    • Add plugin to composer.json and run composer update
  • DB search/replace mysql query { When importing/exporting local/remote dbs }

    update wp_posts set guid = replace(guid, "OLD", "NEW");
    update wp_options set option_value = replace(option_value, "OLD", "NEW");
    update wp_posts set post_content = replace(post_content, "OLD", "NEW");
    update wp_postmeta set meta_value = replace(meta_value, "OLD", "NEW");
    
  • If repo was cloned without submods as in step 1 from Installation, then run this to correctly setup submods.

    git submodule update --init --recursive
    

To Do:

  1. Add mysql db creation to script
  2. Creds via .env

Credits

Constantine Kiriaze http://www.kiriaze.com @kiriaze

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment