parent
c9a002f640
commit
33adc3f6a7
|
@ -5024,6 +5024,16 @@ a.skip-link {
|
||||||
margin-right: .425rem;
|
margin-right: .425rem;
|
||||||
margin-left: .425rem; }
|
margin-left: .425rem; }
|
||||||
|
|
||||||
|
.post-navigation {
|
||||||
|
padding-top: 1rem;
|
||||||
|
margin-top: 1rem;
|
||||||
|
border-top: 1px solid #373a3c; }
|
||||||
|
|
||||||
|
.nav-previous a,
|
||||||
|
.nav-next a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #373a3c; }
|
||||||
|
|
||||||
.dropdown-menu .dropdown-menu {
|
.dropdown-menu .dropdown-menu {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: block;
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -7,77 +7,75 @@
|
||||||
* @package understrap
|
* @package understrap
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
if ( ! function_exists( 'understrap_posted_on' ) ) :
|
if ( ! function_exists( 'understrap_posted_on' ) ) :
|
||||||
/**
|
/**
|
||||||
* Prints HTML with meta information for the current post-date/time and author.
|
* Prints HTML with meta information for the current post-date/time and author.
|
||||||
*/
|
*/
|
||||||
function understrap_posted_on() {
|
function understrap_posted_on() {
|
||||||
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
|
$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
|
||||||
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
|
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
|
||||||
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>, <time class="updated" datetime="%3$s">' . __( ' Edited %4$s',
|
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>, <time class="updated" datetime="%3$s">' . __( ' Edited %4$s', 'understrap' ) . '</time>';
|
||||||
'understrap' ) . '</time>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$time_string = sprintf( $time_string,
|
|
||||||
esc_attr( get_the_date( 'c' ) ),
|
|
||||||
esc_html( get_the_date() ),
|
|
||||||
esc_attr( get_the_modified_date( 'c' ) ),
|
|
||||||
esc_html( get_the_modified_date() )
|
|
||||||
);
|
|
||||||
|
|
||||||
$posted_on = sprintf(
|
|
||||||
esc_html_x( 'Posted on %s', 'post date', 'understrap' ),
|
|
||||||
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
|
|
||||||
);
|
|
||||||
|
|
||||||
$byline = sprintf(
|
|
||||||
esc_html_x( 'by %s', 'post author', 'understrap' ),
|
|
||||||
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
|
|
||||||
);
|
|
||||||
|
|
||||||
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$time_string = sprintf( $time_string,
|
||||||
|
esc_attr( get_the_date( 'c' ) ),
|
||||||
|
esc_html( get_the_date() ),
|
||||||
|
esc_attr( get_the_modified_date( 'c' ) ),
|
||||||
|
esc_html( get_the_modified_date() )
|
||||||
|
);
|
||||||
|
|
||||||
|
$posted_on = sprintf(
|
||||||
|
esc_html_x( 'Posted on %s', 'post date', 'understrap' ),
|
||||||
|
'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
|
||||||
|
);
|
||||||
|
|
||||||
|
$byline = sprintf(
|
||||||
|
esc_html_x( 'by %s', 'post author', 'understrap' ),
|
||||||
|
'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
|
||||||
|
);
|
||||||
|
|
||||||
|
echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>';
|
||||||
|
|
||||||
|
}
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if ( ! function_exists( 'understrap_entry_footer' ) ) :
|
if ( ! function_exists( 'understrap_entry_footer' ) ) :
|
||||||
/**
|
/**
|
||||||
* Prints HTML with meta information for the categories, tags and comments.
|
* Prints HTML with meta information for the categories, tags and comments.
|
||||||
*/
|
*/
|
||||||
function understrap_entry_footer() {
|
function understrap_entry_footer() {
|
||||||
// Hide category and tag text for pages.
|
// Hide category and tag text for pages.
|
||||||
if ( 'post' == get_post_type() ) {
|
if ( 'post' == get_post_type() ) {
|
||||||
/* translators: used between list items, there is a space after the comma */
|
/* translators: used between list items, there is a space after the comma */
|
||||||
$categories_list = get_the_category_list( __( ', ', 'understrap' ) );
|
$categories_list = get_the_category_list( __( ', ', 'understrap' ) );
|
||||||
if ( $categories_list && understrap_categorized_blog() ) {
|
if ( $categories_list && understrap_categorized_blog() ) {
|
||||||
printf( '<span class="cat-links">' . __( 'Posted in %1$s', 'understrap' ) . '</span>',
|
printf( '<span class="cat-links">' . __( 'Posted in %1$s', 'understrap' ) . '</span>', $categories_list );
|
||||||
$categories_list );
|
|
||||||
}
|
|
||||||
|
|
||||||
/* translators: used between list items, there is a space after the comma */
|
|
||||||
$tags_list = get_the_tag_list( '', __( ', ', 'understrap' ) );
|
|
||||||
if ( $tags_list ) {
|
|
||||||
printf( '<span class="tags-links">' . __( 'Tagged %1$s', 'understrap' ) . '</span>', $tags_list );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
|
/* translators: used between list items, there is a space after the comma */
|
||||||
echo '<span class="comments-link">';
|
$tags_list = get_the_tag_list( '', __( ', ', 'understrap' ) );
|
||||||
comments_popup_link( __( 'Leave a comment', 'understrap' ), __( '1 Comment', 'understrap' ),
|
if ( $tags_list ) {
|
||||||
__( '% Comments', 'understrap' ) );
|
printf( '<span class="tags-links">' . __( 'Tagged %1$s', 'understrap' ) . '</span>', $tags_list );
|
||||||
echo '</span>';
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
|
||||||
|
echo '<span class="comments-link">';
|
||||||
|
comments_popup_link( __( 'Leave a comment', 'understrap' ), __( '1 Comment', 'understrap' ), __( '% Comments', 'understrap' ) );
|
||||||
|
echo '</span>';
|
||||||
|
}
|
||||||
|
|
||||||
edit_post_link(
|
edit_post_link(
|
||||||
sprintf(
|
sprintf(
|
||||||
/* translators: %s: Name of current post */
|
/* translators: %s: Name of current post */
|
||||||
esc_html__( 'Edit %s', 'understrap' ),
|
esc_html__( 'Edit %s', 'understrap' ),
|
||||||
the_title( '<span class="screen-reader-text">"', '"</span>', false )
|
the_title( '<span class="screen-reader-text">"', '"</span>', false )
|
||||||
),
|
),
|
||||||
'<span class="edit-link">',
|
'<span class="edit-link">',
|
||||||
'</span>'
|
'</span>'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,6 +119,38 @@ function understrap_category_transient_flusher() {
|
||||||
// Like, beat it. Dig?
|
// Like, beat it. Dig?
|
||||||
delete_transient( 'understrap_categories' );
|
delete_transient( 'understrap_categories' );
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<nav class="navigation post-navigation">
|
||||||
|
<h1 class="sr-only"><?php _e( 'Post navigation', 'understrap' ); ?></h1>
|
||||||
|
<div class="nav-links">
|
||||||
|
<?php
|
||||||
|
|
||||||
|
if ( get_previous_post_link() ) {
|
||||||
|
previous_post_link( '<span class="nav-previous float-xs-left btn btn-sm btn-secondary">%link</span>', _x( '<span class="fa fa-backward"></span> %title', 'Previous post link', 'understrap' ) );
|
||||||
|
}
|
||||||
|
if ( get_next_post_link() ) {
|
||||||
|
next_post_link( '<span class="nav-next float-xs-right btn btn-sm btn-secondary">%link</span>', _x( '%title <span class="fa fa-forward"></span>', 'Next post link', 'understrap' ) );
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div><!-- .nav-links -->
|
||||||
|
</nav><!-- .navigation -->
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
endif;
|
||||||
|
|
|
@ -130,6 +130,18 @@ a.skip-link {
|
||||||
margin-left: .425rem;
|
margin-left: .425rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.post-navigation {
|
||||||
|
padding-top: 1rem;
|
||||||
|
margin-top: 1rem;
|
||||||
|
border-top: 1px solid $gray-dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-previous a,
|
||||||
|
.nav-next a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: $gray-dark;
|
||||||
|
}
|
||||||
|
|
||||||
// Fixing BS dropdown in a dropdown
|
// Fixing BS dropdown in a dropdown
|
||||||
.dropdown-menu .dropdown-menu {
|
.dropdown-menu .dropdown-menu {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
Reference in New Issue