cleanup inc/template-tags.php

This commit is contained in:
koenemann 2017-02-07 15:30:44 +01:00
parent 8c3ada14a6
commit 9b43e4b0e4
2 changed files with 28 additions and 55 deletions

View File

@ -109,39 +109,3 @@ function understrap_category_transient_flusher() {
add_action( 'edit_category', 'understrap_category_transient_flusher' ); add_action( 'edit_category', 'understrap_category_transient_flusher' );
add_action( 'save_post', 'understrap_category_transient_flusher' ); add_action( 'save_post', 'understrap_category_transient_flusher' );
/**
* Display navigation to next/previous post when applicable.
*/
if ( ! function_exists( 'understrap_post_nav' ) ) :
function understrap_post_nav() {
// Don't print empty markup if there's nowhere to navigate.
$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous ) {
return;
}
?>
<div class="row">
<div class="col-md-12">
<nav class="navigation post-navigation">
<h2 class="sr-only"><?php _e( 'Post navigation', 'understrap' ); ?></h2>
<div class="nav-links">
<?php
if ( get_previous_post_link() ) {
previous_post_link( '<span class="nav-previous float-xs-left">%link</span>', _x( '<i class="fa fa-angle-left"></i>&nbsp;%title', 'Previous post link', 'understrap' ) );
}
if ( get_next_post_link() ) {
next_post_link( '<span class="nav-next float-xs-right">%link</span>', _x( '%title&nbsp;<i class="fa fa-angle-right"></i>', 'Next post link', 'understrap' ) );
}
?>
</div><!-- .nav-links -->
</nav><!-- .navigation -->
</div>
</div>
<?php
}
endif;

View File

@ -1,31 +1,40 @@
<?php <?php
/** /**
* WordPress.com-specific functions and definitions. * WordPress.com-specific functions and definitions
* *
* This file is centrally included from `wp-content/mu-plugins/wpcom-theme-compat.php`. * This file is centrally included from `wp-content/mu-plugins/wpcom-theme-compat.php`.
* *
* @package understrap * @package understrap
*/ */
if ( ! function_exists( 'understrap_wpcom_setup' ) ) { /**
/** * Adds support for wp.com-specific theme functions.
* Adds support for wp.com-specific theme functions. *
* * @global array $themecolors
* @global array $themecolors Array with theme's colors. */
*/ function understrap_wpcom_setup() {
function understrap_wpcom_setup() { global $themecolors;
global $themecolors;
// Set theme colors for third party services. // Set theme colors for third party services.
if ( ! isset( $themecolors ) ) { if ( ! isset( $themecolors ) ) {
$themecolors = array( $themecolors = array(
'bg' => '', 'bg' => '',
'border' => '', 'border' => '',
'text' => '', 'text' => '',
'link' => '', 'link' => '',
'url' => '', 'url' => '',
); );
}
} }
/* Add WP.com print styles */
add_theme_support( 'print-styles' );
} }
add_action( 'after_setup_theme', 'understrap_wpcom_setup' ); add_action( 'after_setup_theme', 'understrap_wpcom_setup' );
/*
* WordPress.com-specific styles
*/
function understrap_wpcom_styles() {
wp_enqueue_style( 'understrap-wpcom', get_template_directory_uri() . '/inc/style-wpcom.css', '20160411' );
}
add_action( 'wp_enqueue_scripts', 'understrap_wpcom_styles' );