Browse Source

Add custom logo support.

pull/13/head
Ned Zimmerman 7 years ago
parent
commit
c2f5f06a96
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 9
      app/controllers/App.php
  2. 7
      app/setup.php
  3. BIN
      resources/assets/images/logo.png
  4. 1
      resources/assets/images/logo.svg
  5. BIN
      resources/assets/images/logo@2x.png
  6. 23
      resources/assets/styles/layouts/_header.scss
  7. 8
      resources/views/partials/footer.blade.php
  8. 14
      resources/views/partials/header.blade.php

9
app/controllers/App.php

@ -6,6 +6,15 @@ use Sober\Controller\Controller;
class App extends Controller
{
public function siteLogo()
{
if (has_custom_logo()) {
return wp_get_attachment_image($custom_logo_id, 'original');
} else {
return file_get_contents(get_theme_file_path() . '/dist/' . svg_path('images/logo.svg'));
}
}
public function siteName()
{
return get_bloginfo('name');

7
app/setup.php

@ -51,7 +51,12 @@ add_action('after_setup_theme', function () {
* Enable custom logos
* @link https://developer.wordpress.org/themes/functionality/custom-logo/
*/
add_theme_support('custom-logo');
add_theme_support('custom-logo', [
'height' => 40,
'width' => 265,
'flex-width' => true,
'flex-height' => true,
]);
/**
* Enable post thumbnails

BIN
resources/assets/images/logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

1
resources/assets/images/logo.svg

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
resources/assets/images/logo@2x.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

23
resources/assets/styles/layouts/_header.scss

@ -51,11 +51,16 @@
}
.brand {
width: 109px;
height: 17px;
width: 6.5625rem;
height: auto;
margin: 30px 0 0 17px;
background-image: url('../images/logo.png'); // TODO
background-size: 109px 17px;
svg,
img {
width: auto;
max-width: 100%;
height: auto;
}
}
.primary-navigation {
@ -115,11 +120,9 @@
}
.brand {
width: 265px;
height: 40px;
width: 16.5625rem;
height: auto;
margin-top: 40px;
background-image: url('../images/logo@2x.png'); // TODO
background-size: 265px 40px;
}
.primary-navigation {
@ -139,11 +142,11 @@
color: var(--brand-primary, $brand-primary);
}
&.catalog {
&:nth-child(1) {
margin-right: auto;
}
&.contact {
&:nth-child(2) {
margin: 0 1em 0 auto;
}
}

8
resources/views/partials/footer.blade.php

@ -35,10 +35,10 @@
<div class="pressbooks-links">
<h1><a href="https://pressbooks.com">{!! sprintf(__('Powered by %s', 'aldine'), '<span class="pressbooks">Pressbooks</span>') !!}</a></h1>
<ul>
<li>{{ __('Open Source', 'aldine') }}</li>
<li>{{ __('Open Textbooks', 'aldine') }}</li>
<li>{{ __('Open Book Publishing', 'aldine') }}</li>
<li>{{ __('Learn More', 'aldine') }}</li>
<li><a href="https://pressbooks.org">{{ __('Open Source', 'aldine') }}</a></li>
<li><a href="https://pressbooks.com/for-academia">{{ __('Open Textbooks', 'aldine') }}</a></li>
<li><a href="https://pressbooks.com">{{ __('Open Book Publishing', 'aldine') }}</a></li>
<li><a href="https://pressbooks.com/about">{{ __('Learn More', 'aldine') }}</a></li>
</ul>
</div>
<div class="social-media">

14
resources/views/partials/header.blade.php

@ -1,18 +1,18 @@
<section class="banner bg-bottom cover" style="background-image: url(@php(header_image()));">
<div class="container flex flex-column justify-between items-center w-100 mw-100">
<a class="toggle-menu db dn-l absolute" href="#primary-navigation">{{ __('Toggle menu', 'aldine') }}<span class="icon db absolute"></span></a>
<a class="brand db self-start self-center-l" href="{{ home_url('/') }}"><span class="clip>"{{ get_bloginfo('name', 'display') }}</a></a>
<a class="brand db self-start self-center-l" href="{{ home_url('/') }}"><span class="clip">{{ get_bloginfo('name', 'display') }}</span>{!! $site_logo !!}</a>
<nav id="primary-navigation" class="primary-navigation absolute flex flex-column justify-center items-start top-0 w-100 bg-transparent bg-animate flex-row-l justify-start-l items-center-l">
<a class="catalog" href="{{ home_url('/catalog') }}">Catalog</a>
<a class="contact" href="#contact">Contact</a>
<a href="{{ home_url('/catalog') }}">Catalog</a>
<a href="#contact">Contact</a>
@if(!is_user_logged_in())
<a class="signin" href="{{ wp_login_url() }}">{{ __('Sign in', 'aldine') }}</a>
<a href="{{ wp_login_url() }}">{{ __('Sign in', 'aldine') }}</a>
<span class="sep">/</span>
<a class="signup" href="{{ network_home_url('/wp-signup.php') }}">{{ __('Sign up', 'aldine') }}</a>
<a href="{{ network_home_url('/wp-signup.php') }}">{{ __('Sign up', 'aldine') }}</a>
@else
<a class="admin" href="{{ admin_url() }}">{{ __('Admin', 'aldine') }}</a>
<a href="{{ admin_url() }}">{{ __('Admin', 'aldine') }}</a>
<span class="sep">/</span>
<a class="signin" href="{{ wp_logout_url() }}">{{ __('Sign out', 'aldine') }}</a>
<a href="{{ wp_logout_url() }}">{{ __('Sign out', 'aldine') }}</a>
@endif
</nav>
<header class="branding flex flex-column justify-start items-center tc">

Loading…
Cancel
Save