MDG Base is a WordPress starter theme based on Roots, which uses HTML5 Boilerplate & Bootstrap. It's here to help make better themes.
=== ###All Theme Dependencies/Tools Install Info ####Node.js
- Bower
npm install -g bower
- Uglify
npm install -g uglify-js
- JSCS
npm install -g jscs
- JSHint
npm install -g jshint
- Grunt-CLI
npm install -g grunt-cli
- Browser Sync
npm install -g browser-sync
- JSDoc (work in progress)
####Growl/Growl Notify ( optional for grunt-notify )
####Image Optim ( required for grunt-imageoptim ) ####Image Alpha ( required for grunt-imageoptim ) ####JPEG Mini ( optional for grunt-imageoptim )
####Homebrew
- Homebrew PHP
- PHP 5.5
brew install php55
- Composer
brew install composer
- PHPDocumentor
brew install phpdocumentor
- GraphViz (used to create graphs)
####RVM/Ruby
===
###Quick Start Prerequisites
- Node.js
- Bower
- Composer
###Quick Start
- cd /path/to/mdg-base/
- chmod +x dev-assets/init.sh
- ./init.sh
=== ####PHP Documentation (work in progress) docs/php/index.html
=== ####JSDocs (work in progress)
=== ####Setup vHost (MAMP)
-
Create file
/Applications/MAMP/conf/apache/vhosts.conf
-
Add a vHost to
/Applications/MAMP/conf/apache/vhosts.conf
# NOTE: Change *:80 to *:8888 if not using default apache ports # NOTE: Change Sitename to your sitename.extension, I suggest using sitename.dev <VirtualHost *:80> ServerName sitename.dev DocumentRoot /Applications/MAMP/htdocs/sitename <Directory /Applications/MAMP/sitename/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> </VirtualHost>
-
Include
vhosts.conf
in/Applications/MAMP/conf/apache/http.conf
# NOTE: Change *:80 to *:8888 if not using default apache ports NameVirtualHost *:80 Include /Applications/MAMP/conf/apache/vhosts.conf
-
Add site to
/etc/hosts
with nano, vim, or other editor127.0.0.1 sitename.dev
-
Restart server
-
Access site at http://sitename.dev
-
To add more sites duplicate steps 2(add vHost) and 4(add site to hosts)
=== ####Query Examples
#####Default WP_Query
$custom_query_args = array(
'post_type' => $this->post_type,
'posts_per_page' => -1,
'post_status' => 'publish',
'order' => 'DESC',
'orderby' => 'date',
);
$custom_query = new WP_Query( $custom_query_args );
$custom = $custom_query->get_posts();
#####MDG_Custom_Post_Type Query
- Builds in transient caching
- Returns the exact same data as the default WP_Query above.
- Should not be used with orderby random or if you are using a drag/drop sorting plugin when using orderly menu_order
// Default
global $mdg_custom_post_type;
$custom_query_args = array();
$custom = $mdg_custom_post_type->get_posts( $custom_query_args );
// Custom Arguments (Accepts anything that WP_Query does)
$custom_query_args = array(
'posts_per_page' = 10,
);
$custom = $mdg_custom_post_type->get_posts( $custom_query_args ); // Returns the last 10 posts
=== ####Custom Meta Example(work in progress)
global $my_post_type;
// Retrieves all the current posts meta.
$all_post_meta = $my_post_type->get_post_meta();
// Retrieves a single post meta value
$single_post_meta = $my_post_type->get_post_meta();
// Then you can use extract() and have quick access to the meta using the meta id minus the post type and lower case
// if the meta id = posttype_meta_key then the variable will be $meta_key;
extract( $all_post_meta );
extract( $single_post_meta );
// You can use pp() to check what meta this post has.
pp( $all_post_meta );
===
###Folder Sturcutre
├── assets
│ ├── bower_components (Bower componenets)
│ ├── css (Minified production CSS files)
│ │ └── scss
│ │ ├── admin (SCSS for wp-admin styles)
│ │ ├── plugins (SCSS for plugins not managed by bower)
│ │ └── site (SCSS for front end styles)
│ ├── fonts (@font-face fonts)
│ ├── img (Front end images)
│ │ ├── admin (Images for use in wp-admin)
│ │ └── plugins (Images for plugins not managed by bower)
│ └── js (Minified production JavaScript files)
│ ├── src (All JavaScript source files)
│ │ ├── admin (JavaScript for wp-admin)
│ │ ├── plugins (JavaScript/jQuery plugins/libs not maintained by bower)
│ │ └── site (JavaScript for the front end)
│ └── vendor (External Javascript not concatenated into site.min.js)
├── classes (Post Type base classes and other helper classes)
├── dev-assets (Storage for files used during development)
├── lang (Language local files)
├── lib (Configuration)
└── templates (Content templates)