Browse Source

Add social media to network footer.

pull/9/head
Ned Zimmerman 7 years ago
parent
commit
c65ceb3980
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 11
      app/admin.php
  2. 22
      app/controllers/App.php
  3. 0
      app/controllers/FrontPage.php
  4. 45
      resources/assets/styles/layouts/_footer.scss
  5. 37
      resources/views/front-page.blade.php
  6. 24
      resources/views/partials/footer.blade.php

11
app/admin.php

@ -20,25 +20,14 @@ add_action('customize_register', function (\WP_Customize_Manager $wp_customize)
]);
$wp_customize->add_setting('pb_network_facebook', [
'type' => 'option',
'transport' => 'postMessage'
]);
$wp_customize->add_control('pb_network_facebook', [
'label' => __('Facebook', 'aldine'),
'section' => 'pb_network_social',
'settings' => 'pb_network_facebook',
]);
$wp_customize->add_setting('pb_network_linkedin', [
'type' => 'option',
'transport' => 'postMessage'
]);
$wp_customize->add_control('pb_network_linkedin', [
'label' => __('LinkedIn', 'aldine'),
'section' => 'pb_network_social',
'settings' => 'pb_network_linkedin',
]);
$wp_customize->add_setting('pb_network_twitter', [
'type' => 'option',
'transport' => 'postMessage'
]);
$wp_customize->add_control('pb_network_twitter', [
'label' => __('Twitter', 'aldine'),

22
app/controllers/App.php

@ -11,6 +11,28 @@ class App extends Controller
return get_bloginfo('name');
}
public function networkFacebook()
{
return get_option('pb_network_facebook');
}
public function networkTwitter()
{
return get_option('pb_network_twitter');
}
public static function networkFooter($index)
{
if ($index === 2) {
if (get_option('pb_network_facebook') || get_option('pb_network_twitter') || is_active_sidebar("network-footer-block-$index")) {
return "network-footer-block-$index";
} else {
return 'empty';
}
}
return (is_active_sidebar("network-footer-block-$index")) ? "network-footer-block-$index" : 'empty';
}
public static function title()
{
if (is_home()) {

0
app/controllers/Home.php → app/controllers/FrontPage.php

45
resources/assets/styles/layouts/_footer.scss

@ -21,6 +21,10 @@
text-decoration: none;
}
.network-footer-block.empty {
display: none;
}
.network-footer-block:first-of-type {
border-top: 0;
}
@ -41,6 +45,24 @@
.network-footer-block-3 {
padding: 30px 7.5px 0;
}
.network-footer-block .social-media {
width: 100%;
a {
margin: 0 0.5em 0 0;
}
}
}
.social-media {
margin-top: 1em;
a {
font-size: 32px;
margin: 0 0.25em;
transition: all 0.4s;
}
}
.pressbooks-footer {
@ -99,16 +121,6 @@
align-items: center;
justify-content: center;
}
.social-media {
margin-top: 1em;
a {
font-size: 32px;
margin: 0 0.25em;
transition: all 0.4s;
}
}
}
}
@ -134,11 +146,23 @@
border-right: solid 1px $white;
}
.network-footer-block-2 {
flex-direction: column;
justify-content: center;
}
.network-footer-block:last-of-type {
border-right: 0;
}
}
.social-media {
a {
font-size: 24px;
margin: 0 0.5em 0 0;
}
}
.pressbooks-footer {
flex-direction: row;
justify-content: space-between;
@ -185,7 +209,6 @@
margin-top: 0;
a {
font-size: 24px;
margin: 0 0 0 0.5em;
}
}

37
resources/views/front-page.blade.php

@ -0,0 +1,37 @@
@extends('layouts.app')
@section('content')
@if($block_count === 0)
<div class="block block-1">
<div class="inside">
<h3>{{ __('About Pressbooks', 'aldine')}}</h3>
<p>{{ __('Pressbooks is easy-to-use book writing software that lets you create a book in all the formats you need to publish.', 'aldine')}}</p>
</div>
</div>
@elseif($block_count < 5)
@for($i = 0; $i < $block_count; $i++)
<div class="block block-{{ $i + 1 }}@if($latest_books_block === $home_blocks[$i]) latest-books @endif">
<div class="inside">
@php(dynamic_sidebar($home_blocks[$i]))
</div>
</div>
@endfor
@elseif($block_count === 5)
<div class="one-two">
@for($i = 0; $i < 2; $i++)
<div class="block block-{{ $i + 1 }}@if($latest_books_block === $home_blocks[$i]) latest-books @endif">
<div class="inside">
@php(dynamic_sidebar($home_blocks[$i]))
</div>
</div>
@endfor
</div>
@for($i = 2; $i < $block_count; $i++)
<div class="block block-{{ $i + 1 }}@if($latest_books_block === $home_blocks[$i]) latest-books @endif">
<div class="inside">
@php(dynamic_sidebar($home_blocks[$i]))
</div>
</div>
@endfor
@endif
@endsection

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

@ -1,16 +1,24 @@
<footer class="content-info">
<div class="container">
<section class="network-footer">
@if(is_active_sidebar('network-footer-block-1'))
<div class="network-footer-block network-footer-block-1">
@php(dynamic_sidebar('network-footer-block-1'))
</div>
@endif
@if(is_active_sidebar('network-footer-block-2'))
<div class="network-footer-block network-footer-block-2">
<div class="network-footer-block {{ App::networkFooter(1) }}">
@if(App::networkFooter(1) !== 'empty')
@php(dynamic_sidebar('network-footer-block-1'))
@endif
</div>
<div class="network-footer-block {{ App::networkFooter(2) }}">
@if(App::networkFooter(2) !== 'empty')
@php(dynamic_sidebar('network-footer-block-2'))
@endif
<div class="social-media">
@if($network_facebook)
<a class="facebook" href="{{ $network_facebook }}" title="{{ sprintf(__('%s on Facebook', 'aldine'), get_bloginfo('name', 'display')) }}"><i class="fa fa-facebook-official"></i></a>
@endif
@if($network_twitter)
<a class="twitter" href="{{ $network_twitter }}" title="{{ sprintf(__('%s on Twitter', 'aldine'), get_bloginfo('name', 'display')) }}"><i class="fa fa-twitter"></i></a>
@endif
</div>
@endif
</div>
<div class="network-footer-block network-footer-menu">
@php(wp_nav_menu('network-footer-menu'))
</div>

Loading…
Cancel
Save