简体   繁体   中英

custom theme to wordpress roots theme

I am new to roots theme and want to change my custom wordpress theme to roots theme. What are the steps that i should follow so that finally m able to get my theme in roots. I would be glad if there is such tutorials that help me getting started to roots and converting my theme to roots. Any link please help

thanks, suku

Roots has some dependencies, so you would need to use Grunt.

My answer is based on a Windows local environment.

Make sure you set your wp-config file for Roots for development or you'll notice nothing changes in your css when you update: define('WP_ENV', 'development'); .

  1. Make a new folder in your WordPress theme directory.
  2. Grab the latest ZIP from the Github for Roots and take the guts to set up in your theme.
  3. Extract the zip. Contents should all be saved in the folder of your new theme. As you can see if you look around, some of the assets are missing because you really do need to use Grunt for this to work.
  4. Download and install Node.js
  5. Install grunt (go to the Node.js command prompt and type in npm install -g grunt-cli to install Grunt globally on your system so you can access from a project folder anywhere. You can use the command where grunt to make sure the path is under user > AppData > Roaming > npm .
  6. Install Git Bash
  7. Right click in your new roots theme folder and click Git Bash Here and then type in npm install .
  8. Install Roots dependencies by running grunt dev . Run grunt watch to watch the folder for code changes. Edit your code to style accordingly and ass needed (assets/less is where the style mods should live (global, and in layouts folder) and lib/extras.php for function overrides).
  9. Run grunt built command to create minified asses for a live environment (and then change your wp-config to define('WP_ENV', 'production'); so it uses those assets.

After that you can port the theme out (minus the node_modules folder since it's added bloat you don't need) and install.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM