Browse Source

Add support for Instagram to Aldine (#212)

* Add support for Instagram to Aldine customizer

* Replace instagram logo

Use SVG that matches other social icons

* Fix Instagram SVG size

* Fix linting error
pull/213/head
Steel Wagstaff 5 years ago committed by GitHub
parent
commit
ab9e471a6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      footer.php
  2. 1
      header.php
  3. 13
      inc/customizer/namespace.php

19
footer.php

@ -14,6 +14,7 @@
$network_facebook = get_option( 'pb_network_facebook' ); $network_facebook = get_option( 'pb_network_facebook' );
$network_twitter = get_option( 'pb_network_twitter' ); $network_twitter = get_option( 'pb_network_twitter' );
$network_instagram = get_option( 'pb_network_instagram' );
$pb_network_contact_form = get_option( 'pb_network_contact_form' ); $pb_network_contact_form = get_option( 'pb_network_contact_form' );
$pb_network_contact_link = get_option( 'pb_network_contact_link' ); $pb_network_contact_link = get_option( 'pb_network_contact_link' );
@ -50,7 +51,7 @@ if ( $pb_network_contact_form ) {
<?php dynamic_sidebar( 'network-footer-block-1' ); ?> <?php dynamic_sidebar( 'network-footer-block-1' ); ?>
</div> </div>
<?php } ?> <?php } ?>
<?php if ( is_active_sidebar( 'network-footer-block-2' ) || ! empty( $network_facebook ) || ! empty( $network_twitter ) ) { ?> <?php if ( is_active_sidebar( 'network-footer-block-2' ) || ! empty( $network_facebook ) || ! empty( $network_twitter ) || ! empty( $network_instagram ) ) { ?>
<div class="footer__network__block footer__network__block--2"> <div class="footer__network__block footer__network__block--2">
<?php dynamic_sidebar( 'network-footer-block-2' ); ?> <?php dynamic_sidebar( 'network-footer-block-2' ); ?>
<div class="social-media"> <div class="social-media">
@ -58,7 +59,7 @@ if ( $pb_network_contact_form ) {
<?php /* translators: %s network name */ ?> <?php /* translators: %s network name */ ?>
<a class="facebook" href="<?php echo $network_facebook; ?>" title="<?php printf( __( '%s on Facebook', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?>"> <a class="facebook" href="<?php echo $network_facebook; ?>" title="<?php printf( __( '%s on Facebook', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?>">
<svg class="icon--svg"> <svg class="icon--svg">
<use xlink:href="#facebook" /> <use href="#facebook" />
</svg> </svg>
<?php /* translators: %s network name */ ?> <?php /* translators: %s network name */ ?>
<span class="screen-reader-text"><?php printf( __( '%s on Facebook', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?></span> <span class="screen-reader-text"><?php printf( __( '%s on Facebook', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?></span>
@ -68,12 +69,22 @@ if ( $pb_network_contact_form ) {
<?php /* translators: %s network name */ ?> <?php /* translators: %s network name */ ?>
<a class="twitter" href="<?php echo $network_twitter; ?>" title="<?php printf( __( '%s on Twitter', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?>"> <a class="twitter" href="<?php echo $network_twitter; ?>" title="<?php printf( __( '%s on Twitter', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?>">
<svg class="icon--svg"> <svg class="icon--svg">
<use xlink:href="#twitter" /> <use href="#twitter" />
</svg> </svg>
<?php /* translators: %s network name */ ?> <?php /* translators: %s network name */ ?>
<span class="screen-reader-text"><?php printf( __( '%s on Twitter', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?></span> <span class="screen-reader-text"><?php printf( __( '%s on Twitter', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?></span>
</a> </a>
<?php } ?> <?php } ?>
<?php if ( ! empty( $network_instagram ) ) { ?>
<?php /* translators: %s network name */ ?>
<a class="instagram" href="<?php echo $network_instagram; ?>" title="<?php printf( __( '%s on Instagram', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?>">
<svg class="icon--svg">
<use href="#instagram" />
</svg>
<?php /* translators: %s network name */ ?>
<span class="screen-reader-text"><?php printf( __( '%s on Instagram', 'pressbooks-aldine' ), get_bloginfo( 'name', 'display' ) ); ?></span>
</a>
<?php } ?>
</div> </div>
</div> </div>
<?php } ?> <?php } ?>
@ -105,7 +116,7 @@ if ( $pb_network_contact_form ) {
</a> </a>
<a class="twitter" href="https://twitter.com/intent/follow?screen_name=pressbooks" title="<?php _e( 'Pressbooks on Twitter', 'pressbooks-aldine' ); ?>"> <a class="twitter" href="https://twitter.com/intent/follow?screen_name=pressbooks" title="<?php _e( 'Pressbooks on Twitter', 'pressbooks-aldine' ); ?>">
<svg class="icon--svg"> <svg class="icon--svg">
<use xlink:href="#twitter" /> <use href="#twitter" />
</svg> </svg>
<span class="screen-reader-text"><?php _e( 'Pressbooks on Twitter', 'pressbooks-aldine' ); ?></span></a> <span class="screen-reader-text"><?php _e( 'Pressbooks on Twitter', 'pressbooks-aldine' ); ?></span></a>
</div> </div>

1
header.php

@ -33,6 +33,7 @@
</symbol> </symbol>
<symbol id="facebook" fill="currentColor" viewbox="0 0 512 512"><path d="M451 5c7 0 13 2 17 7 5 4 7 10 7 17v390c0 7-2 13-7 17-4 5-10 7-17 7H339V273h57l9-66h-66v-42c0-11 3-19 7-24 5-5 13-8 26-8h35V73c-12-1-29-2-51-2-26 0-46 7-62 23-15 15-23 36-23 64v49h-57v66h57v170H61c-7 0-13-2-17-7-5-4-7-10-7-17V29c0-7 2-13 7-17 4-5 10-7 17-7z"/></symbol> <symbol id="facebook" fill="currentColor" viewbox="0 0 512 512"><path d="M451 5c7 0 13 2 17 7 5 4 7 10 7 17v390c0 7-2 13-7 17-4 5-10 7-17 7H339V273h57l9-66h-66v-42c0-11 3-19 7-24 5-5 13-8 26-8h35V73c-12-1-29-2-51-2-26 0-46 7-62 23-15 15-23 36-23 64v49h-57v66h57v170H61c-7 0-13-2-17-7-5-4-7-10-7-17V29c0-7 2-13 7-17 4-5 10-7 17-7z"/></symbol>
<symbol id="twitter" fill="currentColor" viewbox="0 0 512 512"><path d="M161 433c193 0 299-161 299-300v-14c20-15 38-34 52-55-19 9-40 14-60 17 22-13 38-34 46-59-21 13-43 21-67 26-32-35-84-44-126-21s-64 71-53 117c-84-4-163-44-216-110C8 82 22 144 68 175c-17 0-33-5-48-13v1c0 50 36 94 85 104-16 4-32 5-48 2 14 43 54 72 98 73-37 30-83 46-130 45-8 0-17 0-25-1 48 31 104 47 161 47"/></symbol> <symbol id="twitter" fill="currentColor" viewbox="0 0 512 512"><path d="M161 433c193 0 299-161 299-300v-14c20-15 38-34 52-55-19 9-40 14-60 17 22-13 38-34 46-59-21 13-43 21-67 26-32-35-84-44-126-21s-64 71-53 117c-84-4-163-44-216-110C8 82 22 144 68 175c-17 0-33-5-48-13v1c0 50 36 94 85 104-16 4-32 5-48 2 14 43 54 72 98 73-37 30-83 46-130 45-8 0-17 0-25-1 48 31 104 47 161 47"/></symbol>
<symbol id="instagram" fill="currentColor" viewbox="0 0 512 512"><path d="M341.33,256A85.33,85.33,0,1,0,256,341.33,85.49,85.49,0,0,0,341.33,256Zm46,0A131.32,131.32,0,1,1,256,124.68,131.15,131.15,0,0,1,387.32,256Zm36-136.66a30.67,30.67,0,1,1-30.66-30.66A30.59,30.59,0,0,1,423.32,119.34ZM256,46c-37.33,0-117.32-3-151,10.33A81.93,81.93,0,0,0,75.68,75.68,81.93,81.93,0,0,0,56.35,105C43,138.68,46,218.67,46,256S43,373.32,56.35,407a81.93,81.93,0,0,0,19.33,29.33A81.93,81.93,0,0,0,105,455.65C138.68,469,218.67,466,256,466s117.32,3,151-10.33A87.25,87.25,0,0,0,455.65,407C469,373.32,466,293.33,466,256s3-117.32-10.33-151a81.93,81.93,0,0,0-19.33-29.33A81.93,81.93,0,0,0,407,56.35C373.32,43,293.33,46,256,46ZM512,256c0,35.33.33,70.33-1.67,105.66C508.31,402.65,499,439,469,469s-66.33,39.33-107.32,41.33c-35.33,2-70.33,1.67-105.66,1.67s-70.33.33-105.66-1.67C109.35,508.31,73,499,43,469S3.69,402.65,1.69,361.66C-.31,326.33,0,291.33,0,256s-.33-70.33,1.67-105.66C3.69,109.35,13,73,43,43S109.35,3.69,150.34,1.69C185.67-.31,220.67,0,256,0s70.33-.33,105.66,1.67C402.65,3.69,439,13,469,43s39.33,66.33,41.33,107.32C512.31,185.67,512,220.67,512,256Z"/></symbol>
<symbol id="arrow-right" fill="currentColor" viewBox="0 0 512 512"><path d="M291 32c0 6 3 12 7 17l133 135H23c-13 0-23 11-23 24s10 24 23 24h408L298 367c-4 4-7 10-7 16s3 12 7 17c10 9 24 9 33 0l173-176c9-9 9-23 0-33L331 15c-9-10-23-10-33 0-4 4-7 10-7 17"/></symbol> <symbol id="arrow-right" fill="currentColor" viewBox="0 0 512 512"><path d="M291 32c0 6 3 12 7 17l133 135H23c-13 0-23 11-23 24s10 24 23 24h408L298 367c-4 4-7 10-7 16s3 12 7 17c10 9 24 9 33 0l173-176c9-9 9-23 0-33L331 15c-9-10-23-10-33 0-4 4-7 10-7 17"/></symbol>
<symbol id="arrow-left" fill="currentColor" viewBox="0 0 512 512"><path d="M220 45c0 6-3 12-7 17L79 200h410c12 0 23 11 23 25 0 13-11 24-23 24H79l134 138c4 5 7 11 7 17 0 7-3 13-7 18-10 9-24 9-33 0L7 242c-9-10-9-25 0-34L180 26c9-9 23-9 33 0 4 5 7 11 7 19"/></symbol> <symbol id="arrow-left" fill="currentColor" viewBox="0 0 512 512"><path d="M220 45c0 6-3 12-7 17L79 200h410c12 0 23 11 23 25 0 13-11 24-23 24H79l134 138c4 5 7 11 7 17 0 7-3 13-7 18-10 9-24 9-33 0L7 242c-9-10-9-25 0-34L180 26c9-9 23-9 33 0 4 5 7 11 7 19"/></symbol>
<symbol id="checkmark" viewBox="0 0 20 16"> <symbol id="checkmark" viewBox="0 0 20 16">

13
inc/customizer/namespace.php

@ -150,6 +150,19 @@ function customize_register( \WP_Customize_Manager $wp_customize ) {
'settings' => 'pb_network_twitter', 'settings' => 'pb_network_twitter',
] ]
); );
$wp_customize->add_setting(
'pb_network_instagram', [
'type' => 'option',
'sanitize_callback' => 'esc_url_raw',
]
);
$wp_customize->add_control(
'pb_network_instagram', [
'label' => __( 'Instagram', 'pressbooks-aldine' ),
'section' => 'pb_network_social',
'settings' => 'pb_network_instagram',
]
);
if ( defined( 'PB_PLUGIN_VERSION' ) ) { if ( defined( 'PB_PLUGIN_VERSION' ) ) {
$wp_customize->add_section( $wp_customize->add_section(

Loading…
Cancel
Save