edge_framework 0.10.0 → 1.0.0

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmNjMGJmNTY4MjNjNjkzMjdiN2I5ZGUyNjE2YjBjZDFiM2Q2ZmE4MQ==
4
+ YWUzNjU2ZjMwOWNhYTg2MjkwMGM1ZWIyM2FmNjdhMTIwM2RhZWY4Yw==
5
5
  data.tar.gz: !binary |-
6
- ZTMwYjE0ODgxYjA2NzljZjE0NDc2MjJjZmZmOTQxODAwYTdhMzE1NA==
6
+ OTYzOTM1YzdkODkxYmVjMWNiNzQ4MTkxMTRlNGRiZTM2ZGZhMGI1OQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MGFhOTQ4ODM2ZWExYmI0ZWVmNWU4MTUxZDhiZDkwN2U1MDI3Mjk1MmMwZjcx
10
- YWU1MWJkZTBjZDcxODRhYjVhZWUyNzk0M2RjYWVkYmNkZGJlYTdhMzNlYjEz
11
- NGVkYTAyZDI2ZDdhYjJjY2NkNGNkMjUyNTZlYmVjOTZhOGFhNDA=
9
+ YmExYTg2YTI4MjI4Zjg3OTZmOWEwMjQ1ZDRiZmVkNDE5ZWQxNzA5YzA5M2Ni
10
+ ODFjYjk2MTg0ODUyMGI0NWZlNDRmM2IwYmE2NzE1YmYwMjQ2MzE2YmZiODdk
11
+ OGY1ZjY1ZGZiNzUxYmNjY2UxZGRiMWY3YWMyYzAyNmU1NGRiM2M=
12
12
  data.tar.gz: !binary |-
13
- YWI0OGRlOTAzODZkMzU1ZjI4NjIyYTM5NDkwNjQwMzRmMWFhMWEwNWRmZDA2
14
- NmYxODU4OTY1YWFkYzkzMmUzZjhlY2Q4OWRmYmE3MTc0NTU0OWE3M2IzMDUy
15
- NDljNTc0NjAyYjdkZWU2OTdjMmFmNzk1ODQwNjRkY2Q2MWRkOWI=
13
+ YWNjMDg4YjRjMzQyMzEyOWUwYTY4MjNjYjQyOTFhYjkyNmY3MTNkM2Y3NTQ4
14
+ NjdhMTRmZmQ5MDA3MzNiNTM1MzE5MWEwODY4ZjM5OGZhNjU2OGU3ZjM4NTRj
15
+ YjdjMWVhYjAxZWI4NWE2YWI0MjNmYzUyZGJlOWMwZmUwMDIzYzE=
data/README.md CHANGED
@@ -258,8 +258,8 @@ Slider visible only on large screen
258
258
  // or
259
259
  <div role="banner" class="hide-for-small"></div>
260
260
 
261
- TEMPLATE GENERATOR
262
- ====================
261
+ BOILERPLATE GENERATOR
262
+ ========================
263
263
 
264
264
  Generate basic template for your project. Run this command inside your project directory:
265
265
 
@@ -271,11 +271,82 @@ Generate basic template for your project. Run this command inside your project d
271
271
 
272
272
  `edge create php`
273
273
 
274
- 3. Rails (run inside Rails project)
274
+ 3. Wordpress 3.8+ (Min PHP 5.3)
275
+
276
+ `edge create wordpress`
277
+
278
+ 4. Rails (run inside Rails project)
275
279
 
276
280
  `rails g edge:install`
277
281
 
278
- 4. Coming soon: Wordpress, Sinatra, and Flask
282
+ 5. Coming soon: Sinatra and Flask
283
+
284
+
285
+ WORDPRESS
286
+ ====================
287
+
288
+ ![Edge Wordpress](http://cdn.setyono.net/edge/wp-edge.jpg)
289
+
290
+ Features:
291
+
292
+ - Auto add header and footer.
293
+ - Independent from any plugin.
294
+ - Cleaner WP Query call.
295
+ - Easily create custom post type and taxonomy.
296
+
297
+ Custom WP Query
298
+ ---------------------
299
+
300
+ Post::find()
301
+ get all posts.
302
+
303
+ Post::find($args_array)
304
+ get post(s) based on the arguments array.
305
+
306
+ Post::find_by($key, $value)
307
+ faster way of writing Post::find(array( $key => $value ))
308
+
309
+ All of the functions above returns `WP_Query()` object. [Refer here](https://gist.github.com/luetkemj/2023628) for available argument.
310
+
311
+ Example:
312
+
313
+ $posts = Post::find_by("category_name", "featured");
314
+
315
+ if( $posts->have_posts() ):
316
+ while( $posts->have_posts() ): $posts->the_post();
317
+ ...
318
+ endwhile;
319
+ endif;
320
+
321
+
322
+ Custom Post Type
323
+ --------------------
324
+
325
+ add_post_type( $name, <$icon>, <$taxonomy> )
326
+
327
+ ![Wordpress Custom Type](http://cdn.setyono.net/edge/wp-post-type.jpg)
328
+
329
+ Inside `functions.php`, add these codes:
330
+
331
+ add_post_type("Product", "cart", "Brand");
332
+ add_post_type("Event", "calendar");
333
+
334
+ All names must be **singular**. The icon name is taken from [melchoyce.github.io/dashicons/](http://melchoyce.github.io/dashicons/).
335
+
336
+ To enable custom WP Query, create a class with the Post Type's name that extends `Post`.
337
+
338
+ // still inside functions.php
339
+ class Product extends Post {}
340
+ class Event extends Post {}
341
+
342
+ Now, you can call the functions:
343
+
344
+ $products = Product::find_by("brand", "Microsoft")
345
+ $events = Event::find()
346
+
347
+ The template file for custom post is `single-{slug}.php` while custom taxonomy is `taxonomy-{slug}.php`.
348
+
349
+ Based on the example above, create `single-product.php` for single **Product** template. If we need to list all products within a brand, create `taxonomy-brand.php` which works the same way as `category.php`.
279
350
 
280
351
  COMPASS
281
352
  =================
@@ -320,9 +391,9 @@ GRID - mixin
320
391
 
321
392
  Custom grid makes the markup cleaner and less duplication.
322
393
 
323
- It allows one additional sizing: **mini** which is below 480px on default. You can only set mini size when small size is specified.
394
+ It allows one additional sizing: **mini** which is below 480px by default. You can only set mini size when small size is specified.
324
395
 
325
- Base class ("row" and "column") must be explicitly written.
396
+ We still need to write the base class (`.row` and `.column`).
326
397
 
327
398
  // HTML
328
399
  <div class="row">
@@ -345,9 +416,7 @@ Base class ("row" and "column") must be explicitly written.
345
416
 
346
417
  **GUTTER**
347
418
 
348
- If you want to modify the global gutter, change it in Setting file.
349
-
350
- But if you want it only on specific set of columns, apply it in both row and column.
419
+ If you want to modify all the gutters, change it in Setting file. Otherwise, you must customize both row and column.
351
420
 
352
421
  // HTML
353
422
  <div class="my-row row">
@@ -478,3 +547,4 @@ Template generator:
478
547
  rails g edge:install
479
548
 
480
549
  The command will give you Edge's SCSS files and append the pipeline.
550
+
@@ -18,13 +18,12 @@ $experimental-support-for-khtml : false;
18
18
  // OUTPUT CONFIG
19
19
  // Debug : if true - add useful functionality for development
20
20
  // Responsive : add responsiveness to the output
21
- // Vertical-rhythm : vertically-align all header, paragraph, and list
21
+ //
22
22
  // External call : Add extra feature if calling Component's mixin externally
23
23
  // Include : if false - no CSS output
24
24
  // -------------------------------------------------------
25
25
  $debug : false !default;
26
26
  $responsive : true !default;
27
- $vertical-rhythm : false !default;
28
27
 
29
28
  $external-call : false !default; // user shouldn't modify this
30
29
 
@@ -57,12 +57,11 @@ $button-color: $main-color !default;
57
57
  display: inline-block;
58
58
  cursor: pointer;
59
59
  position: relative;
60
+
60
61
  border: 1px solid transparent;
61
-
62
62
  padding: 10px 20px;
63
- text-transform: uppercase;
63
+
64
64
  font-weight: 700;
65
- letter-spacing: 1px;
66
65
  }
67
66
 
68
67
  background-color: $color;
@@ -70,10 +69,7 @@ $button-color: $main-color !default;
70
69
 
71
70
  @if $for-base {
72
71
  @include border-radius($g-radius);
73
- @include background-image(linear-gradient(top, rgba(white, .1), transparent ) );
74
72
  @include transition($g-transition);
75
- @include box-shadow(inset 1px 1px rgba(white, .1) );
76
-
77
73
  @include button-focus();
78
74
  }
79
75
 
@@ -64,15 +64,14 @@ $ol-child-style : lower-alpha !default;
64
64
  p {
65
65
  @include trailer(1);
66
66
 
67
- &:last-child,
68
- &:last-of-type {
67
+ &:last-child {
69
68
  @include trailer(0);
70
69
  }
70
+ }
71
71
 
72
- + ul,
73
- + ol {
74
- @include trailer(1);
75
- }
72
+ ul,
73
+ ol {
74
+ @include trailer(1);
76
75
  }
77
76
  }
78
77
 
@@ -106,10 +105,6 @@ body {
106
105
  color: $body-font-color;
107
106
  }
108
107
 
109
- .baseline {
110
- @include baseline();
111
- }
112
-
113
108
  h1, h2, h3, h4, h5, h6 {
114
109
  color: $header-font-color;
115
110
  font-family: $header-font-family;
@@ -120,25 +115,17 @@ a {
120
115
  color: $main-color;
121
116
  }
122
117
 
123
- @if $vertical-rhythm {
124
- @include vertical-rhythm($for-base: true);
125
- }
126
- @else {
127
- h1 { font-size: em($h1-font-size); }
128
- h2 { font-size: em($h2-font-size); }
129
- h3 { font-size: em($h3-font-size); }
130
- h4 { font-size: em($h4-font-size); }
131
- h5 { font-size: em($h5-font-size); }
132
- h6 { font-size: em($h6-font-size); }
133
118
 
134
- p {
135
- margin-top: 0;
136
- margin-bottom: $p-margin-bottom;
119
+ h1 { font-size: em($h1-font-size); }
120
+ h2 { font-size: em($h2-font-size); }
121
+ h3 { font-size: em($h3-font-size); }
122
+ h4 { font-size: em($h4-font-size); }
123
+ h5 { font-size: em($h5-font-size); }
124
+ h6 { font-size: em($h6-font-size); }
137
125
 
138
- &:last-child {
139
- margin-bottom: 0;
140
- }
141
- }
126
+ p {
127
+ margin-top: 0;
128
+ margin-bottom: $p-margin-bottom;
142
129
  }
143
130
 
144
131
  // -----------
@@ -1,6 +1,6 @@
1
1
  /* ------------------------------------------
2
2
  - EDGE Framework - github.com/HennerS/Edge
3
- - v0.10.0 (Davion)
3
+ - v1.0.0 (Davion)
4
4
  ------------------------------------------ */
5
5
 
6
6
  @import "edge/base";
data/lib/edge/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Edge
2
- VERSION = "0.10.0"
2
+ VERSION = "1.0.0"
3
3
  CODENAME = "Davion"
4
4
  end
@@ -29,7 +29,6 @@ $sub-color : #d7d7d7;
29
29
  // ----------------
30
30
  // $responsive : true;
31
31
  // $debug : false;
32
- // $vertical-rhythm : false;
33
32
 
34
33
  // $include-tile : true;
35
34
  // $include-visibility : true;
@@ -1,7 +1 @@
1
- <?php get_header(); ?>
2
-
3
- <p><small>404.php</small></p>
4
-
5
- <h1>Page Not Found</h1>
6
-
7
- <?php get_footer(); ?>
1
+ <h1>Page Not Found</h1>
@@ -1,29 +1,3 @@
1
- <?php
2
- /* -------------------------
3
- View Category Template
4
- ------------------------- */
5
- get_header(); ?>
1
+ <h1>Category: <?php single_cat_title(); ?></h1>
6
2
 
7
- <p><small>category.php</small></p>
8
-
9
- <p><a href="<?php home(); ?>">&larr; Home</a></p>
10
-
11
- <h1><?php echo ucfirst(single_cat_title('', false) ); ?></h1>
12
-
13
- <?php // If the category has description
14
- if(category_description() ): ?>
15
- <p><?php echo category_description(); ?></p>
16
- <?php endif; ?>
17
-
18
- <?php if (have_posts() ): ?>
19
- <h3>Posts</h3>
20
- <ul>
21
- <?php while (have_posts() ): the_post(); ?>
22
- <a href="<?php echo get_permalink(); ?>">
23
- <li><?php echo get_the_title(); ?></li>
24
- </a>
25
- <?php endwhile; ?>
26
- </ul>
27
- <?php endif; ?>
28
-
29
- <?php get_footer(); ?>
3
+ <?php get_template_part("content", "posts"); ?>
@@ -0,0 +1,140 @@
1
+ <?php
2
+ // Thanks to http://www.eval.ca/articles/php-pluralize (MIT license)
3
+ // http://dev.rubyonrails.org/browser/trunk/activesupport/lib/active_support/inflections.rb (MIT license)
4
+ // http://www.fortunecity.com/bally/durrus/153/gramch13.html
5
+ // http://www2.gsu.edu/~wwwesl/egw/crump.htm
6
+
7
+ class Inflector {
8
+ static $plural = array(
9
+ '/(quiz)$/i' => "$1zes",
10
+ '/^(ox)$/i' => "$1en",
11
+ '/([m|l])ouse$/i' => "$1ice",
12
+ '/(matr|vert|ind)ix|ex$/i' => "$1ices",
13
+ '/(x|ch|ss|sh)$/i' => "$1es",
14
+ '/([^aeiouy]|qu)y$/i' => "$1ies",
15
+ '/(hive)$/i' => "$1s",
16
+ '/(?:([^f])fe|([lr])f)$/i' => "$1$2ves",
17
+ '/(shea|lea|loa|thie)f$/i' => "$1ves",
18
+ '/sis$/i' => "ses",
19
+ '/([ti])um$/i' => "$1a",
20
+ '/(tomat|potat|ech|her|vet)o$/i'=> "$1oes",
21
+ '/(bu)s$/i' => "$1ses",
22
+ '/(alias)$/i' => "$1es",
23
+ '/(octop)us$/i' => "$1i",
24
+ '/(ax|test)is$/i' => "$1es",
25
+ '/(us)$/i' => "$1es",
26
+ '/s$/i' => "s",
27
+ '/$/' => "s"
28
+ );
29
+
30
+ static $singular = array(
31
+ '/(quiz)zes$/i' => "$1",
32
+ '/(matr)ices$/i' => "$1ix",
33
+ '/(vert|ind)ices$/i' => "$1ex",
34
+ '/^(ox)en$/i' => "$1",
35
+ '/(alias)es$/i' => "$1",
36
+ '/(octop|vir)i$/i' => "$1us",
37
+ '/(cris|ax|test)es$/i' => "$1is",
38
+ '/(shoe)s$/i' => "$1",
39
+ '/(o)es$/i' => "$1",
40
+ '/(bus)es$/i' => "$1",
41
+ '/([m|l])ice$/i' => "$1ouse",
42
+ '/(x|ch|ss|sh)es$/i' => "$1",
43
+ '/(m)ovies$/i' => "$1ovie",
44
+ '/(s)eries$/i' => "$1eries",
45
+ '/([^aeiouy]|qu)ies$/i' => "$1y",
46
+ '/([lr])ves$/i' => "$1f",
47
+ '/(tive)s$/i' => "$1",
48
+ '/(hive)s$/i' => "$1",
49
+ '/(li|wi|kni)ves$/i' => "$1fe",
50
+ '/(shea|loa|lea|thie)ves$/i'=> "$1f",
51
+ '/(^analy)ses$/i' => "$1sis",
52
+ '/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => "$1$2sis",
53
+ '/([ti])a$/i' => "$1um",
54
+ '/(n)ews$/i' => "$1ews",
55
+ '/(h|bl)ouses$/i' => "$1ouse",
56
+ '/(corpse)s$/i' => "$1",
57
+ '/(us)es$/i' => "$1",
58
+ '/s$/i' => ""
59
+ );
60
+
61
+ static $irregular = array(
62
+ 'move' => 'moves',
63
+ 'foot' => 'feet',
64
+ 'goose' => 'geese',
65
+ 'sex' => 'sexes',
66
+ 'child' => 'children',
67
+ 'man' => 'men',
68
+ 'tooth' => 'teeth',
69
+ 'person' => 'people'
70
+ );
71
+
72
+ static $uncountable = array(
73
+ 'sheep',
74
+ 'fish',
75
+ 'deer',
76
+ 'series',
77
+ 'species',
78
+ 'money',
79
+ 'rice',
80
+ 'information',
81
+ 'equipment'
82
+ );
83
+
84
+ public static function pluralize( $string ) {
85
+ // save some time in the case that singular and plural are the same
86
+ if ( in_array( strtolower( $string ), self::$uncountable ) ) {
87
+ return $string;
88
+ }
89
+
90
+ // check for irregular singular forms
91
+ foreach ( self::$irregular as $pattern => $result ) {
92
+ $pattern = '/' . $pattern . '$/i';
93
+
94
+ if ( preg_match( $pattern, $string ) ) {
95
+ return preg_replace( $pattern, $result, $string);
96
+ }
97
+ }
98
+
99
+ // check for matches using regular expressions
100
+ foreach ( self::$plural as $pattern => $result ) {
101
+ if ( preg_match( $pattern, $string ) ) {
102
+ return preg_replace( $pattern, $result, $string );
103
+ }
104
+ }
105
+
106
+ return $string;
107
+ }
108
+
109
+ public static function singularize( $string ) {
110
+ // save some time in the case that singular and plural are the same
111
+ if ( in_array( strtolower( $string ), self::$uncountable ) ) {
112
+ return $string;
113
+ }
114
+
115
+ // check for irregular plural forms
116
+ foreach ( self::$irregular as $result => $pattern ) {
117
+ $pattern = '/' . $pattern . '$/i';
118
+
119
+ if ( preg_match( $pattern, $string ) ) {
120
+ return preg_replace( $pattern, $result, $string);
121
+ }
122
+ }
123
+
124
+ // check for matches using regular expressions
125
+ foreach ( self::$singular as $pattern => $result ) {
126
+ if ( preg_match( $pattern, $string ) ) {
127
+ return preg_replace( $pattern, $result, $string );
128
+ }
129
+ }
130
+ return $string;
131
+ }
132
+
133
+ public static function pluralize_if($count, $string) {
134
+ if ($count == 1) {
135
+ return "1 $string";
136
+ } else {
137
+ return $count . " " . self::pluralize($string);
138
+ }
139
+ }
140
+ }
@@ -0,0 +1,173 @@
1
+ <?php
2
+ /* -------------------------------------------
3
+ EDGE Press v1.0
4
+ - Cleaner code for Wordpress Theme
5
+ - Requirement: Wordpress 3.8 and PHP 5.3
6
+ ------------------------------------------- */
7
+ include "inflector.php";
8
+
9
+ function home() { echo home_url()."/"; }
10
+ function root() { return get_template_directory_uri()."/"; }
11
+ function img() { echo root()."assets/img/"; }
12
+ function css() { echo root()."assets/css/"; }
13
+ function js() { echo root()."assets/js/"; }
14
+ function files() { echo root()."assets/files/"; }
15
+
16
+ /*
17
+ ELLIPSIZE
18
+ - Adding "..." at the end of the string.
19
+ - Default is 160 characters
20
+ */
21
+
22
+ function ellipsize($text, $char_number = "160", $etc = "...") {
23
+ $text = html_entity_decode($text, ENT_QUOTES);
24
+ if (strlen($text) > $char_number) {
25
+ $text = substr($text, 0, $char_number);
26
+ $text = substr($text,0,strrpos($text," "));
27
+
28
+ $punctuation = ".!?:;,-"; // punctuation you want removed
29
+
30
+ $text = (strspn(strrev($text), $punctuation) != 0)
31
+ ?
32
+ substr($text, 0, -strspn(strrev($text), $punctuation))
33
+ :
34
+ $text;
35
+
36
+ $text = $text.$etc;
37
+ }
38
+ $text = htmlentities($text, ENT_QUOTES);
39
+ return $text;
40
+ }
41
+
42
+ /*
43
+ CUSTOM NAV MENU
44
+ */
45
+
46
+ function edge_nav_menu() {
47
+ wp_nav_menu(array(
48
+ "container" => "nav",
49
+ "container_class" => " ",
50
+ "container_id" => "",
51
+ "menu_class" => " ",
52
+ "menu_id" => " ",
53
+ ));
54
+ }
55
+
56
+ /*
57
+ DATABASE CALL
58
+ */
59
+
60
+ class Post {
61
+ public static function find($args = null) {
62
+ wp_reset_postdata();
63
+
64
+ if(empty($args) ) {
65
+ $args = array(
66
+ "post_type" => get_called_class()
67
+ );
68
+ }
69
+
70
+ return new WP_Query($args);
71
+ }
72
+
73
+ public static function find_by($key, $value) {
74
+ wp_reset_postdata();
75
+
76
+ $args = array(
77
+ $key => $value,
78
+ "post_type" => get_called_class()
79
+ );
80
+ return new WP_Query($args);
81
+ }
82
+ }
83
+
84
+ class Page extends Post {}
85
+
86
+ /*
87
+ CUSTOM POST TYPE
88
+ */
89
+
90
+ function add_post_type($name, $icon = "admin-post", $tax_name = null) {
91
+ $plural = Inflector::pluralize($name);
92
+ $singular = $name;
93
+
94
+ $labels = array(
95
+ "name" => $plural,
96
+ "singular_name" => $singular,
97
+ "add_new_item" => "Add New " . $singular,
98
+ "edit_item" => "Edit " . $singular,
99
+ "new_item" => "New " . $singular,
100
+ "view_item" => "View " . $singular,
101
+ "search_items" => "Search " . $plural,
102
+ "not_found" => "No " . strtolower($plural) . " found",
103
+ "not_found_in_trash" => "No " . strtolower($plural) . " found in Trash",
104
+ "parent_item_colon" => "Parent " . $singular . ":",
105
+ );
106
+
107
+ $post_args = array(
108
+ "public" => true,
109
+ "menu_icon" => "dashicons-".$icon,
110
+ "labels" => $labels,
111
+ "capability_type" => "post",
112
+ "supports" => array(
113
+ "title",
114
+ "editor",
115
+ "custom-fields",
116
+ "revisions",
117
+ "thumbnail",
118
+ ),
119
+ );
120
+
121
+ // If taxonomy is given
122
+ if($tax_name) {
123
+ add_taxonomy($tax_name, $name);
124
+ }
125
+
126
+ register_post_type(strtolower($name), $post_args);
127
+ }
128
+
129
+ /*
130
+ CUSTOM TAXONOMY
131
+ */
132
+
133
+ function add_taxonomy($name, $post_type) {
134
+ $plural = Inflector::pluralize($name);
135
+ $singular = $name;
136
+
137
+ $labels = array(
138
+ "name" => $plural,
139
+ "singular_name" => $singular,
140
+ "all_items" => "All " . $plural,
141
+ "edit_item" => "Edit " . $singular,
142
+ "view_item" => "View " . $singular,
143
+ "update_item" => "Update " . $singular,
144
+ "add_new_item" => "Add New " . $singular,
145
+ "parent_item" => "Parent " . $singular,
146
+ "search_items" => "Search " . $plural,
147
+ "popular_items" => "Popular " . $plural,
148
+ "add_or_remove_items" => "Add or remove " . strtolower($plural),
149
+ "choose_from_most_used" => "Choose from the most used " . strtolower($plural),
150
+ "not_found" => "No " . strtolower($plural) . " found"
151
+ );
152
+
153
+ $tax_args = array(
154
+ "labels" => $labels,
155
+ "show_ui" => true,
156
+ "query_var" => true,
157
+ "show_admin_column" => false,
158
+ "hierarchical" => true,
159
+ );
160
+ register_taxonomy(strtolower($name), strtolower($post_type), $tax_args);
161
+ }
162
+
163
+ /* REMOVE MENU ITEMS */
164
+ add_action("admin_menu", "remove_menu_items");
165
+
166
+
167
+ /* AUTO ADD HEADER and FOOTER */
168
+ add_filter("template_include", function($template) {
169
+ get_header();
170
+ include $template;
171
+ get_footer();
172
+ return FALSE;
173
+ });
@@ -0,0 +1,24 @@
1
+ <?php // If not page, comment allowed, and comment supported
2
+ if(!is_page() && comments_open() && post_type_supports(get_post_type(), "comments") ): ?>
3
+
4
+ <?php if(have_comments() ): ?>
5
+ <h2><?php comments_number(); ?></h2>
6
+
7
+ <ul>
8
+ <?php foreach($comments as $comment): ?>
9
+ <li>
10
+ <?php comment_text(); ?>
11
+
12
+ <cite><?php comment_type(); ?> by <?php comment_author_link(); ?> on <?php comment_date(); ?> at <?php comment_time(); ?></cite>
13
+
14
+ <?php if ($comment->comment_approved == "0") : ?>
15
+ <p>Your comment is awaiting approval</p>
16
+ <?php endif; ?>
17
+ </li>
18
+ <?php endforeach; ?>
19
+ </ul>
20
+ <?php endif; ?>
21
+
22
+ <?php comment_form(); ?>
23
+
24
+ <?php endif; ?>
@@ -0,0 +1,15 @@
1
+ <?php if(have_posts() ): while (have_posts() ) : the_post(); ?>
2
+
3
+ <h1><?php the_title(); ?></h1>
4
+
5
+ <?php if(has_post_thumbnail() ): ?>
6
+ <figure>
7
+ <?php the_post_thumbnail(); ?>
8
+ </figure>
9
+ <?php endif; ?>
10
+
11
+ <?php the_content(); ?>
12
+
13
+ <?php comments_template(); ?>
14
+
15
+ <?php endwhile; endif; ?>
@@ -0,0 +1,15 @@
1
+ <ul>
2
+ <?php if (have_posts() ): ?>
3
+ <?php while (have_posts() ): the_post(); ?>
4
+ <li>
5
+ <a href="<?php the_permalink(); ?>">
6
+ <?php the_title(); ?>
7
+ </a>
8
+ </li>
9
+ <?php endwhile; ?>
10
+ <?php else: ?>
11
+ <li>
12
+ <a>Not found</a>
13
+ </li>
14
+ <?php endif; ?>
15
+ </ul>
@@ -1,6 +1,8 @@
1
1
  <div id="footer-push"></div>
2
2
  </div>
3
- <footer class="main-footer"></footer>
3
+ <footer class="main-footer">
4
+ <!-- Write footer here -->
5
+ </footer>
4
6
 
5
7
  <!-- JAVASCRIPT LIBRARY -->
6
8
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
@@ -13,5 +15,6 @@
13
15
  <script src="<?php js(); ?>/vendor/fastclick.min.js"></script>
14
16
  <script src="<?php js(); ?>/app.js"></script>
15
17
 
18
+ <?php wp_footer(); ?>
16
19
  </body>
17
20
  </html>
@@ -1,62 +1,24 @@
1
- <?php
2
- /* ------------------------------------
3
- EDGE Press v0.1
4
- - Extend functionality to Word Press
5
- --------------------------------------- */
1
+ <?php include "code/main.php";
6
2
 
3
+ // THEME SUPPORT
7
4
  add_theme_support("post-thumbnails");
5
+ add_theme_support("menus");
8
6
 
9
- function root() {
10
- return get_template_directory_uri()."/";
11
- }
12
-
13
- /*
14
- Echo path to assets directory
15
- @return = relative path to specified assets directory
16
- */
17
- function home() { echo home_url()."/"; }
18
- function img() { echo root()."assets/img/"; }
19
- function css() { echo root()."assets/css/"; }
20
- function js() { echo root()."assets/js/"; }
21
- function files() { echo root()."assets/files/"; }
22
-
23
- /*
24
- Ellipsize the text (Adding "..." at the end of the word)
25
- Always stop at the end of a word.
26
- @param text = The statement to be ellipsized
27
- char_number = Number of characters before adding the ellipse
28
- etc = The ellipse text to be added, default to "..."
29
- @return = the ellipsed text
7
+ /* CUSTOM POST TYPE
8
+ 1: Type name, MUST be singular
9
+ 2: (opt) Icon name, check http://melchoyce.github.io/dashicons/
10
+ 3: (opt) Taxonomy name, MUST be singular
30
11
  */
31
- function ellipsize($text, $char_number, $etc = "...") {
32
- $text = html_entity_decode($text, ENT_QUOTES);
33
- if (strlen($text) > $char_number) {
34
- $text = substr($text, 0, $char_number);
35
- $text = substr($text,0,strrpos($text," "));
36
-
37
- $punctuation = ".!?:;,-"; // punctuation you want removed
38
-
39
- $text = (strspn(strrev($text), $punctuation) != 0)
40
- ?
41
- substr($text, 0, -strspn(strrev($text), $punctuation))
42
- :
43
- $text;
44
-
45
- $text = $text.$etc;
46
- }
47
- $text = htmlentities($text, ENT_QUOTES);
48
- return $text;
49
- }
12
+ add_post_type("Product", "cart", "Brand"); // Sample
13
+ // Allow the use of Product::find()
14
+ class Product extends Post {};
50
15
 
51
- /*
52
- Automatically use "single-{category_slug}.php" as post template for that category
53
- Example:
54
- "single-product.php" is used as template for post with category "product"
16
+ /* Remove Unnecessary ADMIN SIDEBAR
17
+ - Use the slug
55
18
  */
56
- add_filter("single_template", create_function(
57
- '$the_template',
58
- 'foreach( (array) get_the_category() as $cat ) {
59
- if ( file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php") )
60
- return TEMPLATEPATH . "/single-{$cat->slug}.php"; }
61
- return $the_template;' )
62
- );
19
+ function remove_menu_items() {
20
+ $items = array(
21
+ "upload.php",
22
+ );
23
+ foreach($items as $item) { remove_menu_page($item); }
24
+ }
@@ -18,11 +18,14 @@
18
18
  <!-- STYLESHEET -->
19
19
  <link rel="stylesheet" href="<?php css(); ?>/framework.css">
20
20
  <link rel="stylesheet" href="<?php css(); ?>/app.css">
21
-
22
- <!-- PLUGIN HOOKS -->
21
+
23
22
  <?php wp_head(); ?>
24
23
  </head>
25
24
  <body>
26
25
  <div id="main-wrapper">
27
26
 
28
- <header class="main-header"></header>
27
+ <header class="main-header">
28
+ <?php edge_nav_menu(); ?>
29
+ </header>
30
+
31
+ <?php get_template_part("searchform"); ?>
@@ -1,57 +1,14 @@
1
1
  <?php
2
- /* ----------------------
3
- Home / Landing page
4
- ---------------------- */
5
- get_header();
6
-
7
- // Get list of all categories
8
- $args = array(
9
- "child_of" => 0,
10
- "hide_empty" => false,
11
- );
12
- $categories = get_categories($args);
13
-
14
- // Get list of all pages
15
- $page_args = array(
16
- "child_of" => 0,
17
- "sort_order" => "ASC",
18
- "sort_column" => "post_title",
19
- );
20
- $pages = get_pages($args);
2
+ $posts = Post::find();
21
3
  ?>
22
4
 
23
- <p><small>index.php</small></p>
24
-
25
- <h1>Welcome to <?php bloginfo("name"); ?></h1>
26
-
27
- <h3>Category</h3>
28
- <ul>
29
- <?php foreach ($categories as $category): ?>
30
- <li>
31
- <a href="<?php echo get_category_link( $category->ID ); ?> ">
32
- <?php echo $category->name; ?>
33
- </a>
34
- </li>
35
- <?php endforeach; ?>
36
- </ul>
5
+ <div class="row">
6
+ <div class="large-6 column large-centered">
7
+ <?php if($posts->have_posts() ): while($posts->have_posts() ): $posts->the_post(); ?>
37
8
 
38
- <h3>Pages</h3>
39
- <ul>
40
- <?php foreach ($pages as $page): ?>
41
- <li>
42
- <a href="<?php echo get_page_link( $page->ID ); ?>">
43
- <?php echo $page->post_title; ?>
44
- </a>
45
- </li>
46
- <?php endforeach; ?>
47
- </ul>
48
-
49
- <!-- How to get Page content outside "page" template -->
50
- <h3>About Us</h3>
51
- <?php
52
- $page = get_page_by_title("About Us");
53
- $content = apply_filters("the_content", $page->post_content);
54
- echo $content;
55
- ?>
9
+ <h1><?php the_title(); ?></h1>
10
+ <?php the_content(); ?>
56
11
 
57
- <?php get_footer(); ?>
12
+ <?php endwhile; endif; ?>
13
+ </div>
14
+ </div>
@@ -1,18 +1 @@
1
- <?php
2
- /* ----------------------
3
- Pages Template
4
- ---------------------- */
5
- get_header(); ?>
6
-
7
- <p><small>page.php</small></p>
8
-
9
- <?php while (have_posts() ) : the_post(); ?>
10
- <h1><?php echo get_the_title(); ?></h1>
11
- <?php echo get_the_content(); ?>
12
-
13
- <a href="<?php home(); ?> ">
14
- &larr; Home
15
- </a>
16
- <?php endwhile; ?>
17
-
18
- <?php get_footer(); ?>
1
+ <?php get_template_part("content", "post"); ?>
Binary file
@@ -0,0 +1,3 @@
1
+ <h1>Search result for '<?php echo get_search_query(); ?>'</h1>
2
+
3
+ <?php get_template_part("content", "posts"); ?>
@@ -0,0 +1,4 @@
1
+ <form method="get" action="<?php home(); ?>" role="search">
2
+ <input type="search" name="s" placeholder="Enter keyword">
3
+ <input type="submit" value="Search">
4
+ </form>
@@ -1,23 +1 @@
1
- <?php
2
- /* ----------------------
3
- Single Post Template
4
- ---------------------- */
5
- get_header(); ?>
6
-
7
- <p><small>single.php</small></p>
8
-
9
- <?php while (have_posts() ) : the_post(); ?>
10
- <h1><?php echo get_the_title(); ?></h1>
11
- <h4><?php echo date("D, d M Y" , strtotime(get_the_date() ) ); ?></h4>
12
- <?php echo get_the_content(); ?>
13
-
14
- <?php
15
- $categories = get_the_category();
16
- $category = $categories[0];
17
- ?>
18
- <a href="<?php echo get_category_link($category->cat_ID); ?> ">
19
- &larr; Back
20
- </a>
21
- <?php endwhile; ?>
22
-
23
- <?php get_footer(); ?>
1
+ <?php get_template_part("content", "post"); ?>
@@ -1,10 +1,12 @@
1
1
  /*
2
- Theme Name: Edge Template
2
+ Theme Name: Edge Boilerplate
3
3
  Theme URI: -
4
4
  Author: -
5
5
  Author URI: -
6
6
  Description: -
7
7
  Version: 1.0
8
+ Tags: -
9
+
8
10
  License: -
9
11
  License URI: -
10
12
  */
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: edge_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henner Setyono
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-16 00:00:00.000000000 Z
11
+ date: 2014-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass
@@ -147,11 +147,19 @@ files:
147
147
  - template/rails/application.html.erb
148
148
  - template/wordpress/404.php
149
149
  - template/wordpress/category.php
150
+ - template/wordpress/code/inflector.php
151
+ - template/wordpress/code/main.php
152
+ - template/wordpress/comments.php
153
+ - template/wordpress/content-post.php
154
+ - template/wordpress/content-posts.php
150
155
  - template/wordpress/footer.php
151
156
  - template/wordpress/functions.php
152
157
  - template/wordpress/header.php
153
158
  - template/wordpress/index.php
154
159
  - template/wordpress/page.php
160
+ - template/wordpress/screenshot.png
161
+ - template/wordpress/search.php
162
+ - template/wordpress/searchform.php
155
163
  - template/wordpress/single.php
156
164
  - template/wordpress/style.css
157
165
  homepage: http://edge.setyono.net