marv 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. data/CHANGELOG.md +3 -0
  2. data/README.md +1 -1
  3. data/VERSION +1 -1
  4. data/layouts/config/config.tt +3 -2
  5. data/layouts/default/functions/functions.php.erb +137 -19
  6. data/layouts/default/images/screenshot.png +0 -0
  7. data/layouts/default/includes/filters-admin.php.erb +62 -0
  8. data/layouts/default/includes/filters.php.erb +118 -0
  9. data/layouts/default/includes/helpers.php.erb +132 -0
  10. data/layouts/default/javascripts/admin.coffee +0 -0
  11. data/layouts/default/javascripts/admin.js +1 -1
  12. data/layouts/default/javascripts/theme.coffee +0 -0
  13. data/layouts/default/javascripts/theme.js +1 -1
  14. data/layouts/default/stylesheets/_header.scss.erb +6 -6
  15. data/layouts/default/stylesheets/style.css.scss.erb +1 -29
  16. data/layouts/default/templates/404.php.erb +23 -8
  17. data/layouts/default/templates/archive.php.erb +37 -9
  18. data/layouts/default/templates/author.php.erb +36 -0
  19. data/layouts/default/templates/footer.php +17 -6
  20. data/layouts/default/templates/header.php +44 -0
  21. data/layouts/default/templates/index.php +19 -2
  22. data/layouts/default/templates/page.php +17 -12
  23. data/layouts/default/templates/partials/comments.php.erb +50 -0
  24. data/layouts/default/templates/partials/content-none.php.erb +19 -0
  25. data/layouts/default/templates/partials/content-page.php +9 -0
  26. data/layouts/default/templates/partials/content-single.php +9 -0
  27. data/layouts/default/templates/partials/content.php.erb +16 -0
  28. data/layouts/default/templates/partials/searchform.php.erb +5 -0
  29. data/layouts/default/templates/partials/sidebar.php +7 -0
  30. data/layouts/default/templates/search.php.erb +31 -10
  31. data/layouts/default/templates/single.php +26 -0
  32. data/lib/marv/generator.rb +20 -0
  33. data/marv.gemspec +18 -9
  34. metadata +18 -9
  35. data/layouts/default/stylesheets/_reset.scss +0 -5
  36. data/layouts/default/stylesheets/_typography.scss +0 -5
  37. data/layouts/default/templates/attachment.php.erb +0 -32
  38. data/layouts/default/templates/comments.php +0 -2
  39. data/layouts/default/templates/header.php.erb +0 -30
  40. data/layouts/default/templates/partials/loop.php.erb +0 -36
  41. data/layouts/default/templates/sidebar.php +0 -9
  42. data/layouts/default/templates/single.php.erb +0 -30
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.2.1 ==
2
+ - New default project layout
3
+
1
4
  == 0.2.0 ==
2
5
  - Fix errors
3
6
 
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Marv is a toolkit for bootstrapping and developing WordPress themes using Sass, LESS, and CoffeeScript.
4
4
 
5
- Current Version: **0.1.1**
5
+ [![Gem Version](https://badge.fury.io/rb/marv.svg)](http://badge.fury.io/rb/marv)
6
6
 
7
7
  -----
8
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -1,4 +1,4 @@
1
- # WordPress theme information is stored in source/assets/stylesheets/_header.scss as of Marv version 0.5
1
+ # WordPress theme information is stored in source/assets/stylesheets/_header.scss
2
2
 
3
3
  # JavaScript compression
4
4
  # config[:compress_js] = false
@@ -16,4 +16,5 @@
16
16
  # end
17
17
 
18
18
  # You can also include additional Compass frameworks by requiring them:
19
- # require 'stitch'
19
+ # require 'boubon'
20
+ # require 'neat'
@@ -1,34 +1,152 @@
1
1
  <?php
2
2
 
3
- add_action( 'wp_enqueue_scripts', '<%= theme_id %>_enqueue_scripts' );
3
+ // Block direct access
4
+ if( ! defined( 'ABSPATH' ) ) exit;
4
5
 
5
- if ( ! function_exists( '<%= theme_id %>_enqueue_scripts' ) ) :
6
+ // Set content_width
7
+ if ( ! isset( $content_width ) ) {
8
+ $content_width = 640;
9
+ }
6
10
 
7
- /**
8
- * Add theme styles and scripts here
9
- */
10
- function <%= theme_id %>_enqueue_scripts() {
11
+ // Scaffold setup
12
+ if( ! function_exists( '<%= theme_id %>_setup' ) ) :
13
+
14
+ /**
15
+ * Sets up theme defaults and registers support for various WordPress features.
16
+ *
17
+ * Note that this function is hooked into the after_setup_theme hook, which
18
+ * runs before the init hook. The init hook is too late for some features, such
19
+ * as indicating support for post thumbnails.
20
+ */
21
+ function <%= theme_id %>_setup()
22
+ {
23
+ // Textdomain
24
+ load_theme_textdomain( '<%= theme_id %>', get_template_directory() . '/includes/languages' );
25
+ load_child_theme_textdomain( '<%= theme_id %>', get_stylesheet_directory() . '/includes/languages' );
26
+
27
+ // Theme support
28
+ add_theme_support( 'menus' );
29
+ add_theme_support( 'post-thumbnails' );
30
+ add_theme_support( 'automatic-feed-links' );
31
+ add_theme_support( 'post-formats', array( /* 'aside', 'link', 'gallery', 'status', 'quote', 'image' */ ) );
32
+ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) );
33
+
34
+ // Editor
35
+ add_editor_style( 'assets/css/editor-style.css' );
11
36
 
12
- if ( ! is_admin() ) {
13
- wp_enqueue_style(
14
- '<%= theme_id %>-style',
15
- get_bloginfo( 'stylesheet_url' )
16
- );
37
+ // Menus
38
+ register_nav_menus( array(
39
+ 'primary-menu' => __( 'Primary', '<%= theme_id %>' ),
40
+ 'secondary-menu' => __( 'Secondary', '<%= theme_id %>' ),
41
+ 'footer-menu' => __( 'Footer', '<%= theme_id %>' )
42
+ ) );
17
43
  }
18
44
 
45
+ endif;
46
+
47
+ add_action( 'after_setup_theme', '<%= theme_id %>_setup' );
48
+
49
+ /**
50
+ * Init for theme child
51
+ */
52
+ function <%= theme_id %>_child_init() {
53
+ do_action( '<%= theme_id %>_child_init' );
19
54
  }
20
55
 
21
- endif; // <%= theme_id %>_enqueue_scripts
56
+ add_action( 'after_setup_theme', '<%= theme_id %>_child_init' );
22
57
 
23
- add_action( 'after_setup_theme', '<%= theme_id %>_setup' );
58
+ /**
59
+ * Enqueue scripts and styles.
60
+ */
61
+ function <%= theme_id %>_styles_scripts()
62
+ {
63
+ // Styles
64
+ add_action( 'wp_enqueue_scripts', '<%= theme_id %>_register_styles' );
65
+ add_action( 'wp_enqueue_scripts', '<%= theme_id %>_enqueue_styles' );
66
+
67
+ // Scripts
68
+ add_action( 'wp_enqueue_scripts', '<%= theme_id %>_register_scripts' );
69
+ add_action( 'wp_enqueue_scripts', '<%= theme_id %>_enqueue_scripts' );
70
+
71
+ // Admin scripts
72
+ add_action( 'admin_enqueue_scripts', '<%= theme_id %>_register_admin_scripts' );
73
+ add_action( 'admin_enqueue_scripts', '<%= theme_id %>_enqueue_admin_scripts' );
74
+ }
75
+
76
+ add_action( 'init', '<%= theme_id %>_styles_scripts' );
24
77
 
25
- if ( ! function_exists( '<%= theme_id %>_setup' ) ) :
78
+ /**
79
+ * Register styles.
80
+ */
81
+ function <%= theme_id %>_register_styles()
82
+ {
83
+ // Theme
84
+ wp_register_style( 'style', get_stylesheet_directory_uri() . '/style.css', '', '', 'screen' );
85
+ }
86
+
87
+ /**
88
+ * Enqueue styles.
89
+ */
90
+ function <%= theme_id %>_enqueue_styles()
91
+ {
92
+ wp_enqueue_style( 'style' );
93
+ }
26
94
 
27
95
  /**
28
- * Set up your theme here
29
- */
30
- function <%= theme_id %>_setup() {
31
- add_theme_support( 'post-thumbnails' );
96
+ * Register scripts
97
+ */
98
+ function <%= theme_id %>_register_scripts()
99
+ {
100
+ // Theme
101
+ wp_register_script( 'theme', get_stylesheet_directory_uri() . '/javascripts/theme.js', array( 'jquery' ), '', true );
32
102
  }
33
103
 
34
- endif; // <%= theme_id %>_setup
104
+ /**
105
+ * Enqueue scripts
106
+ */
107
+ function <%= theme_id %>_enqueue_scripts()
108
+ {
109
+ wp_enqueue_script( 'theme' );
110
+
111
+ if ( is_singular() && get_option( 'thread_comments' ) ) {
112
+ wp_enqueue_script( 'comment-reply' );
113
+ }
114
+ }
115
+
116
+ /**
117
+ * Register admin scripts
118
+ */
119
+ function <%= theme_id %>_register_admin_scripts()
120
+ {
121
+ // Admin
122
+ wp_register_script( 'admin', get_stylesheet_directory_uri() . '/javascripts/admin.js', array( 'jquery' ), '', true );
123
+ }
124
+
125
+ /**
126
+ * Enqueue admin scripts
127
+ */
128
+ function <%= theme_id %>_enqueue_admin_scripts()
129
+ {
130
+ wp_enqueue_script( 'admin' );
131
+ }
132
+
133
+ /**
134
+ * Allow automatic updates
135
+ */
136
+ add_filter( 'automatic_updates_is_vcs_checkout', '__return_false' );
137
+
138
+ /**
139
+ * All theme filters
140
+ */
141
+ require get_template_directory() . '/includes/filters.php';
142
+
143
+ /**
144
+ * All theme filters for admin
145
+ */
146
+ require get_template_directory() . '/includes/filters-admin.php';
147
+
148
+ /**
149
+ * Helper functions
150
+ */
151
+ require get_template_directory() . '/includes/helpers.php';
152
+
@@ -0,0 +1,62 @@
1
+ <?php
2
+
3
+ // Block direct access
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ // Only in admin
7
+ if( ! is_admin() ) return;
8
+
9
+ /**
10
+ * Remove contactmethods
11
+ */
12
+ function <%= theme_id %>_edit_contactmethods( $methods )
13
+ {
14
+ unset( $methods['aim'] );
15
+ unset( $methods['jabber'] );
16
+ unset( $methods['yim'] );
17
+
18
+ return $methods;
19
+ }
20
+
21
+ add_filter( 'user_contactmethods', '<%= theme_id %>_edit_contactmethods' );
22
+
23
+ /**
24
+ * Add MCE
25
+ */
26
+ function <%= theme_id %>_enable_more_buttons( $buttons )
27
+ {
28
+ $buttons[] = 'hr';
29
+
30
+ return $buttons;
31
+ }
32
+
33
+ add_filter( 'mce_buttons', '<%= theme_id %>_enable_more_buttons' );
34
+
35
+ /**
36
+ * Remove menu items
37
+ */
38
+ function <%= theme_id %>_remove_menu_pages()
39
+ {
40
+ remove_menu_page( 'link-manager.php' );
41
+ }
42
+
43
+ add_action( 'admin_menu', '<%= theme_id %>_remove_menu_pages' );
44
+
45
+ /**
46
+ * Remove dashboard widgets
47
+ */
48
+ function <%= theme_id %>_remove_dashboard_widgets()
49
+ {
50
+ global $wp_meta_boxes;
51
+
52
+ unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links'] );
53
+ unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'] );
54
+ unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts'] );
55
+ unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments'] );
56
+ unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_primary'] );
57
+ unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary'] );
58
+ // unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_right_now'] );
59
+ // unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press'] );
60
+ }
61
+
62
+ add_action( 'wp_dashboard_setup', '<%= theme_id %>_remove_dashboard_widgets' );
@@ -0,0 +1,118 @@
1
+ <?php
2
+
3
+ // Block direct access
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ /**
7
+ * Independent filters
8
+ */
9
+ add_filter( 'widget_text', 'do_shortcode' );
10
+
11
+ /**
12
+ * Body classes
13
+ */
14
+ function <%= theme_id %>_body_class( $classes )
15
+ {
16
+ global $is_gecko, $is_IE, $is_opera, $is_safari, $is_chrome;
17
+
18
+ if( $is_gecko ) $classes[] = 'gecko';
19
+ elseif( $is_opera ) $classes[] = 'opera';
20
+ elseif( $is_safari ) $classes[] = 'safari';
21
+ elseif( $is_lynx ) $classes[] = 'lynx';
22
+ elseif( $is_chrome ) $classes[] = 'chrome';
23
+ elseif( $is_NS4 ) $classes[] = 'ns4';
24
+ elseif( $is_IE ) $classes[] = 'ie';
25
+ else $classes[] = 'unknown-browser';
26
+ if( $is_iphone ) $classes[] = 'iphone';
27
+
28
+ if( is_singular() ) {
29
+ global $post;
30
+ foreach( ( get_the_category( $post->ID ) ) as $category ) {
31
+ $classes[] = 'term-' . $category->category_nicename;
32
+ }
33
+
34
+ $classes[] = 'singular';
35
+ }
36
+
37
+ if( is_multi_author() ) {
38
+ $classes[] = 'group-blog';
39
+ }
40
+
41
+ if( is_archive() || is_search() || is_home() ) {
42
+ $classes[] = 'list-view';
43
+ }
44
+
45
+ return $classes;
46
+ }
47
+
48
+ add_filter( 'body_class', '<%= theme_id %>_body_class' );
49
+
50
+ /**
51
+ * Remove generator
52
+ */
53
+ function <%= theme_id %>_cleanup_head()
54
+ {
55
+ remove_action('wp_head', 'feed_links', 2);
56
+ remove_action('wp_head', 'feed_links_extra', 3);
57
+ remove_action('wp_head', 'rsd_link');
58
+ remove_action('wp_head', 'wlwmanifest_link');
59
+ remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
60
+ remove_action('wp_head', 'wp_generator');
61
+ remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
62
+ }
63
+
64
+ add_action( 'init', '<%= theme_id %>_cleanup_head' );
65
+
66
+ /**
67
+ * WP title
68
+ */
69
+ function <%= theme_id %>_wp_title( $title, $sep )
70
+ {
71
+ global $paged, $page;
72
+
73
+ if ( is_feed() ) {
74
+ return $title;
75
+ }
76
+
77
+ // Add the site name.
78
+ $title .= get_bloginfo( 'name' );
79
+
80
+ // Add the site description for the home/front page.
81
+ $site_description = get_bloginfo( 'description', 'display' );
82
+ if ( $site_description && ( is_home() || is_front_page() ) ) {
83
+ $title = "$title $sep $site_description";
84
+ }
85
+
86
+ // Add a page number if necessary.
87
+ if ( $paged >= 2 ) {
88
+ $title = "$title $sep " . sprintf( __( 'Page %s', '<%= theme_id %>' ), max( $paged, $page ) );
89
+ }
90
+
91
+ return $title;
92
+ }
93
+
94
+ add_filter( 'wp_title', '<%= theme_id %>_wp_title', 10, 2 );
95
+
96
+ /**
97
+ * Nav object classes
98
+ */
99
+ function <%= theme_id %>_add_extra_menu_classes( $objects )
100
+ {
101
+ $objects[1]->classes[] = 'first';
102
+ $objects[count( $objects )]->classes[] = 'last';
103
+
104
+ return $objects;
105
+ }
106
+
107
+ add_filter( 'wp_nav_menu_objects', '<%= theme_id %>_add_extra_menu_classes' );
108
+
109
+ /**
110
+ * Add favicon
111
+ */
112
+ function <%= theme_id %>_favicon()
113
+ {
114
+ echo '<link rel="shortcut icon" href="' . get_stylesheet_directory_uri() . '/images/favicon.png" type="image/png">';
115
+ }
116
+
117
+ add_action( 'wp_head', '<%= theme_id %>_favicon' );
118
+
@@ -0,0 +1,132 @@
1
+ <?php
2
+
3
+ // Block direct access
4
+ if( ! defined( 'ABSPATH' ) ) exit;
5
+
6
+ /**
7
+ * Helper function to generate normal pagination
8
+ */
9
+ function <%= theme_id %>_paging_nav( $pages = '', $range = 2 )
10
+ {
11
+ $showitems = ( $range * 2 ) + 1;
12
+
13
+ global $paged;
14
+ if( empty( $paged ) ) {
15
+ $paged = 1;
16
+ }
17
+
18
+ if( $pages == '' ) {
19
+ global $wp_query;
20
+ $pages = $wp_query->max_num_pages;
21
+ if( ! $pages ) {
22
+ $pages = 1;
23
+ }
24
+ }
25
+
26
+ if( 1 != $pages ) {
27
+ echo '<div class="pagination">';
28
+ if( $paged > 2 && $paged > $range + 1 && $showitems < $pages ) {
29
+ echo '<a href="' . get_pagenum_link( 1 ) . '">&laquo;</a>';
30
+ }
31
+
32
+ if( $paged > 1 && $showitems < $pages ) {
33
+ echo '<a href="' . get_pagenum_link( $paged - 1 ) . '">&lsaquo;</a>';
34
+ }
35
+
36
+ for ( $i = 1; $i <= $pages; $i++ ) {
37
+ if ( 1 != $pages && ( ! ( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems )) {
38
+ echo ( $paged == $i ) ? '<span class="current">' . $i . '</span>' : '<a href="' . get_pagenum_link( $i ) . '" class="inactive" >' . $i . '</a>';
39
+ }
40
+ }
41
+
42
+ if ( $paged < $pages && $showitems < $pages ) {
43
+ echo '<a href="' . get_pagenum_link( $paged + 1 ) . '">&rsaquo;</a>';
44
+ }
45
+
46
+ if ( $paged < $pages - 1 && $paged + $range - 1 < $pages && $showitems < $pages ) {
47
+ echo '<a href="' . get_pagenum_link($pages) . '">&raquo;</a>';
48
+ }
49
+ echo '</div>';
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Inserts a new key/value before the key in the array.
55
+ *
56
+ * @param $key The key to insert before.
57
+ * @param $array An array to insert in to.
58
+ * @param $new_key The key to insert.
59
+ * @param $new_value An value to insert.
60
+ *
61
+ * @return The new array if the key exists, FALSE otherwise.
62
+ *
63
+ * @see array_insert_after()
64
+ */
65
+ function array_insert_before( $key, array &$array, $new_key, $new_value )
66
+ {
67
+ if (array_key_exists($key, $array)) {
68
+ $new = array();
69
+ foreach ($array as $k => $value) {
70
+ if ($k === $key) {
71
+ $new[$new_key] = $new_value;
72
+ }
73
+
74
+ $new[$k] = $value;
75
+ }
76
+ return $new;
77
+ }
78
+
79
+ return false;
80
+ }
81
+
82
+ /**
83
+ * Inserts a new key/value after the key in the array.
84
+ *
85
+ * @param $key The key to insert after.
86
+ * @param $array An array to insert in to.
87
+ * @param $new_key The key to insert.
88
+ * @param $new_valueAn value to insert.
89
+ *
90
+ * @return The new array if the key exists, FALSE otherwise.
91
+ *
92
+ * @see array_insert_before()
93
+ */
94
+ function array_insert_after( $key, array &$array, $new_key, $new_value )
95
+ {
96
+ if (array_key_exists($key, $array)) {
97
+ $new = array();
98
+ foreach ($array as $k => $value) {
99
+ $new[$k] = $value;
100
+ if ($k === $key) {
101
+ $new[$new_key] = $new_value;
102
+ }
103
+ }
104
+ return $new;
105
+ }
106
+
107
+ return false;
108
+ }
109
+
110
+ /**
111
+ * Flattens a multi-dimensional array to a normal array
112
+ *
113
+ * @param $array Multidimensional array
114
+ *
115
+ * @return The new array
116
+ */
117
+ function array_flatten( $array )
118
+ {
119
+ if( ! is_array( $array ) ) {
120
+ return false;
121
+ }
122
+
123
+ $result = array();
124
+ foreach( $array as $key => $value ) {
125
+ if( is_array( $value ) ) {
126
+ $result = array_merge($result, array_flatten($value));
127
+ } else {
128
+ $result[$key] = $value;
129
+ }
130
+ }
131
+ return $result;
132
+ }