added woocommerce to the theme supports, added a new login form particle to the wp nucleus

This commit is contained in:
NewKind
2015-09-10 21:50:26 +02:00
parent c3e5bc34ee
commit 7e612e172f
7 changed files with 131 additions and 0 deletions
+3
View File
@@ -26,6 +26,9 @@
3. [WordPress](#wordpress)
1. [](#new)
- Implement a particle Widget (#714)
- Added Login Form particle
2. [](#improved)
- Added WooCommerce support in themes declaration
3. [](#bugfix)
- Load style.css on all pages (#819)
+7
View File
@@ -32,6 +32,13 @@ ol.unstyled {
margin-top: 0;
}
.g-loginform fieldset.login-data {
padding: 0;
}
.g-loginform .login-pretext p, .g-loginform .login-posttext p {
margin: 0.5rem 0;
}
.alignnone {
margin: 5px 20px 20px 0;
}
@@ -0,0 +1,70 @@
{% extends '@nucleus/partials/particle.html.twig' %}
{% block particle %}
{% if particle.title %}<h2 class="g-title">{{ particle.title|raw }}</h2>{% endif %}
<div class="g-loginform {{ particle.class|e }}">
{% if not is_user_logged_in %}
<form action="{{ function('wp_login_url', gantry.request.server['REQUEST_URI'])|raw }}" method="post" id="g-loginform">
{% do function('wp_nonce_field', 'log-in') %}
{% if particle.pretext is not empty %}
<div class="login-pretext">
<p>{{ particle.pretext }}</p>
</div>
{% endif %}
<fieldset class="login-data">
<p id="login-username">
<label for="username">{{ __('User Name', 'g5_ethereal') }}</label>
<input id="username" type="text" name="log" class="inputbox" alt="username" size="18" value="" />
</p>
<p id="login-password">
<label for="passwd">{{ __('Password', 'g5_ethereal') }}</label>
<input id="passwd" type="password" name="pwd" class="inputbox" size="18" alt="password" value="" />
</p>
<p id="login-remember">
<label for="remember">{{ __('Remember me', 'g5_ethereal') }}</label>
<input id="remember" type="checkbox" name="rememberme" class="inputbox" />
</p>
<input type="submit" value="{{ __('Log In', 'g5_ethereal') }}" class="button" name="submit" />
</fieldset>
<ul>
<li>
<a href="{{ function('wp_lostpassword_url') }}">{{ __('Forgot your password ?', 'g5_ethereal') }}</a>
</li>
{% if function('get_option', 'users_can_register') %}
<li>
<a href="{{ function('wp_registration_url') }}">{{ __('Register', 'g5_ethereal') }}</a>
</li>
{% endif %}
</ul>
{% if particle.posttext is not empty %}
<div class="login-posttext">
<p>{{ particle.posttext }}</p>
</div>
{% endif %}
</form>
{% else %}
<form action="{{ function('wp_logout_url', gantry.request.server['REQUEST_URI'])|raw }}" method="post" id="g-loginform">
{% do function('wp_nonce_field', 'log-out') %}
<div class="greeting">
<p>{{ particle.greeting|format(current_user.display_name) }}</p>
</div>
<div class="logout-button">
<input type="submit" name="submit" class="button" value="{{ __('Log Out', 'g5_ethereal') }}" />
</div>
</form>
{% endif %}
</div>
{% endblock %}
@@ -0,0 +1,38 @@
name: Login Form
description: Display Login Form.
type: particle
form:
fields:
enabled:
type: input.checkbox
label: Enabled
description: Globally enable Login Form particle.
default: true
class:
type: input.selectize
label: CSS Classes
description: CSS class name for the form.
title:
type: input.text
label: Title
description: Customize the title text.
default: Login
greeting:
type: input.text
label: Greeting
description: Customize the text to be displayed as an user greeting.
default: Hi, %s
pretext:
type: input.text
label: Pre Text
description: Customize the text to be displayed before the login form.
posttext:
type: input.text
label: Post Text
description: Customize the text to be displayed after the login form.
@@ -15,6 +15,7 @@
// WORDPRESS
@import "wordpress/typography";
@import "wordpress/core";
@import "wordpress/particles";
@import "wordpress/utilities";
@import "wordpress/captions";
@import "wordpress/screen-readers";
@@ -0,0 +1,11 @@
.g-loginform {
fieldset.login-data {
padding: 0;
}
.login-pretext, .login-posttext {
p {
margin: 0.5rem 0;
}
}
}
@@ -29,6 +29,7 @@ class Theme extends Base\Theme
add_theme_support( 'post-thumbnails' );
add_theme_support( 'menus' );
add_theme_support( 'widgets' );
add_theme_support( 'woocommerce' );
add_filter( 'timber_context', [ $this, 'add_to_context' ] );
add_filter( 'get_twig', [ $this, 'add_to_twig' ] );
add_action( 'template_redirect', [ $this, 'set_template_layout' ], -10000 );