Skip to content

Commit

Permalink
added post navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
Netzberufler committed Dec 22, 2015
1 parent 47c9f86 commit 134664f
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 10 deletions.
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Leeway Changelog
===================================

Version 1.1.7
-----------------------------------
[added] previous/next post navigation on single post view

Version 1.1.6
-----------------------------------
[added] support for ThemeZee Related Posts plugin
Expand Down
9 changes: 8 additions & 1 deletion css/customizer.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@
*
*/

.customize-control-checkbox {
margin-bottom: 4px;
}

#customize-control-leeway_control_postmeta_headline,
#customize-control-leeway_control_post_footer_headline,
#customize-control-leeway_control_slider_activated {
margin-top: 12px;
margin-top: 16px;
}

#customize-control-leeway_control_featured_posts_header,
#customize-control-leeway_control_slider_animation {
margin-top: 8px;
Expand All @@ -19,6 +25,7 @@
#customize-control-leeway_control_post_images,
#customize-control-leeway_control_excerpt_text_headline,
#customize-control-leeway_control_postmeta_headline,
#customize-control-leeway_control_post_footer_headline,
#customize-control-leeway_control_slider_activated {
margin-bottom: 0;
}
Expand Down
9 changes: 4 additions & 5 deletions inc/customizer/default-options.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ function leeway_default_options() {
'meta_author' => true,
'meta_category' => true,
'meta_tags' => true,
'post_navigation' => false,
'slider_active_magazine' => false,
'slider_active_blog' => false,
'slider_animation' => 'horizontal'
'slider_animation' => 'horizontal',
);

return $default_options;
}


?>

}
37 changes: 34 additions & 3 deletions inc/customizer/sections/customizer-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,38 @@ function leeway_customize_register_post_settings( $wp_customize ) {
'priority' => 9
)
);

// Add Post Footer Settings
$wp_customize->add_setting( 'leeway_theme_options[post_footer_headline]', array(
'default' => '',
'type' => 'option',
'transport' => 'refresh',
'sanitize_callback' => 'esc_attr'
)
);
$wp_customize->add_control( new Leeway_Customize_Header_Control(
$wp_customize, 'leeway_control_post_footer_headline', array(
'label' => esc_html__( 'Post Footer', 'leeway' ),
'section' => 'leeway_section_post',
'settings' => 'leeway_theme_options[post_footer_headline]',
'priority' => 12
)
)
);
$wp_customize->add_setting( 'leeway_theme_options[post_navigation]', array(
'default' => false,
'type' => 'option',
'transport' => 'refresh',
'sanitize_callback' => 'leeway_sanitize_checkbox'
)
);
$wp_customize->add_control( 'leeway_control_post_navigation', array(
'label' => esc_html__( 'Display post navigation on single posts', 'leeway' ),
'section' => 'leeway_section_post',
'settings' => 'leeway_theme_options[post_navigation]',
'type' => 'checkbox',
'priority' => 13
)
);

}

?>
}
20 changes: 19 additions & 1 deletion inc/template-tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,25 @@ function leeway_display_postinfo() {
endif;


// Display Leeway plugin
// Display Single Post Navigation
if ( ! function_exists( 'leeway_display_post_navigation' ) ):

function leeway_display_post_navigation() {

// Get Theme Options from Database
$theme_options = leeway_theme_options();

if ( true == $theme_options['post_navigation'] ) {

the_post_navigation( array( 'prev_text' => '« %title', 'next_text' => '%title »' ) );

}
}

endif;


// Display ThemeZee Related Posts plugin
if ( ! function_exists( 'leeway_display_related_posts' ) ):

function leeway_display_related_posts() {
Expand Down
2 changes: 2 additions & 0 deletions single.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

endif; ?>

<?php leeway_display_post_navigation(); ?>

<?php leeway_display_related_posts(); ?>

<?php comments_template(); ?>
Expand Down
53 changes: 53 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,35 @@ input, textarea, select {
max-width: 100%;
}

/* Text meant only for screen readers. */
.screen-reader-text {
clip: rect(1px, 1px, 1px, 1px);
position: absolute !important;
height: 1px;
width: 1px;
overflow: hidden;
}

.screen-reader-text:focus {
background-color: #f1f1f1;
border-radius: 3px;
box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
clip: auto !important;
color: #21759b;
display: block;
font-size: 14px;
font-size: 0.875rem;
font-weight: bold;
height: auto;
left: 5px;
line-height: normal;
padding: 15px 23px 14px;
text-decoration: none;
top: 5px;
width: auto;
z-index: 100000; /* Above WP toolbar. */
}

/* Basic Structure
-------------------------------------------------------------- */
.container {
Expand Down Expand Up @@ -688,6 +717,30 @@ input, textarea, select {
text-decoration: underline;
}

/* Post Navigation */
.post-navigation {
margin: 0 0 0.5em 0;
padding: 0.8em;
color: #333;
background: #eee;
border-top: 1px solid #ddd;
border-bottom: 2px solid #ddd;
}
.post-navigation .nav-links:before,
.post-navigation .nav-links:after {
content: "";
display: table;
}
.post-navigation .nav-links:after {
clear: both;
}
.post-navigation .nav-links .nav-previous {
float: left;
}
.post-navigation .nav-links .nav-next {
float: right;
}

/* Breadcrumbs */
.breadcrumbs {
font-weight: bold;
Expand Down

0 comments on commit 134664f

Please sign in to comment.