Skip to content

Commit 12a25ff

Browse files
authored
Merge 1.2Beta to Release Master
* add cache-busting * update/debug gulpfile * re-organize build-process * rename main.js to functions.js * rename main.scss to bundler.scss * remove vendor-dependencies from `functions-wppsetup.php` and `bundler.scss` * add all vendor-dependencies to the gulpfile to have them organized in one place * remove bower, use npm for frontend-modules/vendors * add unification to function-names cleanup functions * fix minor bugs and cleanup code * rearrange defaults in vars.scss * remove editor-hiding in elements-template (we can hide it within ACF now)
2 parents fd4b165 + 82dd10e commit 12a25ff

File tree

13 files changed

+283
-55
lines changed

13 files changed

+283
-55
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
# CHANGELOG
22

3-
## HEAD | 1.1.5 | 06.02.2018
3+
## 1.2.0 | 18.02.2018 | «Busted»
4+
* add cache-busting
5+
* update/debug gulpfile
46
* re-organize build-process
57
* rename main.js to functions.js
68
* rename main.scss to bundler.scss
79
* remove vendor-dependencies from `functions-wppsetup.php` and `bundler.scss`
810
* add all vendor-dependencies to the gulpfile to have them organized in one place
911
* remove bower, use npm for frontend-modules/vendors
12+
* add unification to function-names cleanup functions
1013
* fix minor bugs and cleanup code
1114
* rearrange defaults in vars.scss
1215
* remove editor-hiding in elements-template (we can hide it within ACF now)

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<img src="/assets/images/wpseed.png" width="518"/>
22

3-
**Version 1.1.5** (06.02.2018)
3+
**Version 1.2.0** (18.02.2018)
44

55
## What is WPSeed?
66
WPSeed is a WordPress starter theme following the intention of being able to skip the time-consuming first steps when creating a new theme.
@@ -26,6 +26,7 @@ WPSeed uses npm to manage development-modules aswell as frontend-modules and [gu
2626
* in the theme directory run `npm install && gulp`
2727
* add your domain/ip to `browsersync_proxy` in `gulpfile.js`
2828
* you can now use gulp (run `gulp watch` in your theme directory) to compile and optimize your asset files and run browsersync
29+
* you can use any TLD for local development. WPSeed assumes you're using `.vm` for "virtual machine". If you want to use a different TLD make sure to change `.vm` to your preffered TLD in `Vagrantfile`, `gulpfile.js` and `functions-wpsetup.php`.
2930

3031
#### Deployment
3132
* when deploying your website using a deployment-environment like [deploybot](https://deploybot.com/) or [deployHQ](https://www.deployhq.com/) run
@@ -37,6 +38,7 @@ WPSeed uses npm to manage development-modules aswell as frontend-modules and [gu
3738

3839
### General
3940
* All important files provide a description/version at the top. Make sure to read it first.
41+
* Since Version 1.2.0 WPSeed creates cache-busting using [gulp-rev](https://www.npmjs.com/package/gulp-rev). If you're working locally (using the `.vm` TLD) the non-busted stylesheet (style.min.css) is enqueued, to make sure browsersync runs as expected.
4042

4143
### Important Files/Folders
4244

assets/styles/bundle.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*!
1+
/*
22
* Main CSS File
33
* Merges all .scss files (in the desired order) before they're processed by gulp
44
*

functions/functions-access.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* @author Flurin Dürst
66
* @version 1.0
7-
* @since WPSeed 0.11.3
7+
* @since WPSeed 0.11.4
88
*
99
*/
1010

@@ -30,7 +30,7 @@ function is_login_page() {
3030
wp_redirect('/admin'); die();
3131
}
3232

33-
/* MAINTENANCE MODE
33+
/* MAINTENANCE MODE (GERMAN)
3434
/------------------------*/
3535
// show maintenance page if not my ip (is_me() and not logged in as admin)
3636
// remove `false && ` to activate

functions/functions-dev.php

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Functions used for development purposes
44
*
55
* @author Flurin Dürst
6-
* @version 1.6.0
6+
* @version 1.6.1
77
* @since WPegg 0.1.0
88
*
99
*/
@@ -39,7 +39,7 @@ function is_pjax_request() {
3939
/* STRING SHORTENER
4040
/------------------------*/
4141
// shorten strings and append ...
42-
function wpseed_shorten($string,$length,$append="...") {
42+
function shorten($string,$length,$append="...") {
4343
$string = trim($string);
4444
if(strlen($string) > $length) {
4545
$string = substr($string, 0, $length);
@@ -50,7 +50,7 @@ function wpseed_shorten($string,$length,$append="...") {
5050

5151
/* URL CHECK
5252
/------------------------*/
53-
// searches url by string
53+
// searche url by string
5454
// note: also consider using basename($url) or basename(dirname($url)) => http://php.net/manual/de/function.basename.php
5555
function urlcontains($string) {
5656
if (strpos('http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'],$string) == true) {
@@ -60,8 +60,8 @@ function urlcontains($string) {
6060

6161
/* SLUGIFY
6262
/------------------------*/
63-
// creates slugs
64-
// exaple: "Lorem Ipsum 25%" will be "lorem-ipsum-25"
63+
// create slugs
64+
// example: "Lorem Ipsum 25%" will be "lorem-ipsum-25"
6565
function slugify($text) {
6666
// replace non letter or digits by -
6767
$text = preg_replace('~[^\pL\d]+~u', '-', $text);
@@ -89,19 +89,12 @@ function sanitize_output($buffer) {
8989
return $buffer;
9090
}
9191

92-
/* THUMBNAIL URL
93-
/------------------------*/
94-
// output the absolute url of the featured image
95-
// usage: wpseed_the_post_thumbnail_url($post->ID, 'large');
96-
function wpseed_the_post_thumbnail_url($size, $postid) {
97-
echo wp_get_attachment_image_src( get_post_thumbnail_id($postid), $size )['0'];
98-
}
9992

10093
/* BLOG RELATED
10194
/------------------------*/
10295

10396
// Output formatted post-date in german
104-
function wpseed_get_the_date_german() {
97+
function get_the_date_german() {
10598
$months_de = ['Januar','Februar','März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'];
10699
return get_the_date('d.').' '.$months_de[intval(get_the_date('m'))-1].' '.get_the_date('Y');
107100
}

functions/functions-elements.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* WPSeed_Text and WPSeed_Gallery are placeholder presets.
55
*
66
* @author Flurin Dürst
7-
* @version 1.2
7+
* @version 1.2.1
88
* @since WPSeed 0.10.0
99
*
1010
*/
@@ -13,21 +13,21 @@
1313
/----------------------------*/
1414
// adds the title-sub_field to the ACF-element bar. Edit `name` at `add_filter` to match your ACF-value.
1515
// » https://www.advancedcustomfields.com/resources/acf-fields-flexible_content-layout_title/
16-
function acf_flexiblecontent_title( $title, $field, $layout, $i ) {
16+
function WPSeed_acf_flexiblecontent_title( $title, $field, $layout, $i ) {
1717
if (!empty(get_sub_field('title'))) { // remove layout title from text
1818
$title = get_sub_field('title')." ($title)"; // add new title
1919
}
2020
return $title;
2121
}
22-
add_filter('acf/fields/flexible_content/layout_title/name=element', 'acf_flexiblecontent_title', 10, 4);
22+
add_filter('acf/fields/flexible_content/layout_title/name=element', 'WPSeed_acf_flexiblecontent_title', 10, 4);
2323

2424

2525
/* GATHER ELEMENTS
2626
/--------------------------*/
27-
function elements() {
27+
function WPSeed_elements() {
2828
ob_start('sanitize_output');
29-
if (have_rows('elements')):
30-
while (have_rows('elements')): the_row();
29+
if (have_rows('element_content')):
30+
while (have_rows('element_content')): the_row();
3131
if (get_row_layout() == 'text'): WPSeed_Text(); endif;
3232
if (get_row_layout() == 'gallery'): WPSeed_Gallery(); endif;
3333
if (get_row_layout() == 'seperator'): echo '<hr>'; endif;

functions/functions-wpsetup.php

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22
/**
33
* WordPress Setup including
4-
* menus, theme-support settings, general settings and a wp_head cleaner
4+
* menus, theme-support settings, cache-busting integration, a wp_head cleaner and general settings
55
*
66
* @author Flurin Dürst
7-
* @version 1.8.0
7+
* @version 1.9.0
88
* @since WPSeed 0.1.6
99
*
1010
*/
@@ -13,6 +13,22 @@
1313
/* THEME SETUP
1414
/===================================================== */
1515

16+
/* GET CACHE-BUSTED CSS-FILE
17+
/------------------------*/
18+
// get the url to the busted css-file, or the default css-file if working locally (on the TLD `.vm`)
19+
// the busted css file is generated by `gulp cachebust` and is located through dist/rev-manifest.json
20+
function wpseed_get_cachebusted_css() {
21+
$current_tld = substr(strrchr(get_bloginfo('url'),"."),1);
22+
if ($current_tld == 'vm') :
23+
$css_src = '/dist/style.min.css';
24+
else :
25+
$css_manifest_url = get_template_directory_uri() . '/dist/rev-manifest.json';
26+
$css_manifest_content = json_decode(file_get_contents($css_manifest_url), true);
27+
$css_src = '/dist/'.$css_manifest_content['style.min.css'];
28+
endif;
29+
return $css_src;
30+
}
31+
1632
/* ENQUEUE SCRIPTS
1733
/------------------------*/
1834
// enqueue sctipts
@@ -26,7 +42,7 @@ function wpseed_enqueue_scripts_and_styles() {
2642
wp_register_script('wpseed/scripts', get_template_directory_uri() . '/dist/script.min.js', false, array( 'jquery' ), true);
2743
wp_enqueue_script('wpseed/scripts');
2844
# styles
29-
wp_enqueue_style('wpseed/styles', get_template_directory_uri() . '/dist/style.min.css', false, null);
45+
wp_enqueue_style('wpseed/styles', get_template_directory_uri() . wpseed_get_cachebusted_css(), false, null);
3046
# fonts
3147
wp_enqueue_style('google/fonts', 'https://fonts.googleapis.com/css?family=Ubuntu:400,500,700', false, null);
3248
}
@@ -35,13 +51,13 @@ function wpseed_enqueue_scripts_and_styles() {
3551
/* SETUP WP-MENUS
3652
/------------------------*/
3753
// » https://codex.wordpress.org/Function_Reference/register_nav_menus
38-
function register_theme_menus() {
54+
function wpseed_register_theme_menus() {
3955
register_nav_menus([
4056
'mainmenu' => __('Mainmenu'),
4157
'submenu' => __('Submenu')
4258
]);
4359
}
44-
add_action( 'init', 'register_theme_menus');
60+
add_action( 'init', 'wpseed_register_theme_menus');
4561

4662

4763
/* THEME SUPPORT
@@ -84,10 +100,10 @@ function wpseed_theme_features() {
84100

85101
/* Disable Backend Theme-Editor
86102
/------------------------------*/
87-
function remove_editor_menu() {
103+
function wpseed_remove_editor_menu() {
88104
remove_action('admin_menu', '_add_themes_utility_last', 101);
89105
}
90-
add_action('_admin_menu', 'remove_editor_menu', 1);
106+
add_action('_admin_menu', 'wpseed_remove_editor_menu', 1);
91107

92108
/* Disable Admin Bar
93109
/------------------------------*/
@@ -110,7 +126,7 @@ function remove_thumbnail_dimensions( $html, $post_id, $post_image_id ) {
110126
/* WPHEAD CLEANUP
111127
/===================================================== */
112128
// removes unused stuff from wp_head()
113-
function wphead_cleanup () {
129+
function wpseed_wphead_cleanup () {
114130
// remove the generator meta tag
115131
remove_action('wp_head', 'wp_generator');
116132
// remove wlwmanifest link
@@ -138,7 +154,7 @@ function wphead_cleanup () {
138154
// remove canonical links
139155
remove_action('wp_head', 'rel_canonical');
140156
}
141-
add_action('after_setup_theme', 'wphead_cleanup');
157+
add_action('after_setup_theme', 'wpseed_wphead_cleanup');
142158

143159

144160
?>

0 commit comments

Comments
 (0)