Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

post navigation

  • Loading branch information...
commit fc8bb8311855cc4a3aa3545bc58178a16445790d 1 parent 521a60a
@MikeBarnlund authored
View
383 barnlund_tcd.local.sql
383 additions, 0 deletions not shown
View
38 sass/_theme.scss
@@ -295,23 +295,39 @@ footer {
text-align: center;
font-size: 0;
line-height: 23px;
- a.next-post, a.previous-post {
+ a {
@include inline-block();
vertical-align: top;
- width: 89px - 15px;
height: 23px;
line-height: 23px;
- color: #FFF;
- font-size: 12px;
- text-align: center;
+ text-transform: uppercase;
}
- a.next-post {
- background: url(../img/next-post.png) top left no-repeat;
- padding: 0 11px 0 4px;
+ .next-prev {
+ margin-bottom: 40px;
+ a {
+ width: 89px - 15px;
+ color: #FFF;
+ font-size: 12px;
+ text-align: center;
+ }
+ a.next-post {
+ background: url(../img/next-post.png) top left no-repeat;
+ padding: 0 11px 0 4px;
+ }
+ a.previous-post {
+ background: url(../img/previous-post.png) top left no-repeat;
+ padding: 0 4px 0 11px;
+ }
}
- a.previous-post {
- background: url(../img/previous-post.png) top left no-repeat;
- padding: 0 4px 0 11px;
+ .post-names {
+ margin-bottom: 40px;
+ a {
+ width: 40%;
+ color: #ec038a;
+ font-size: 14px;
+ &.next-post { text-align: left; }
+ &.previous-post { text-align: right; }
+ }
}
img { vertical-align: top; padding: 0 7px; }
}
View
12 website/wp-content/themes/la/assets/css/base.css
@@ -217,7 +217,13 @@ footer .copyright a { color: #fff00a; }
.single-post .post { margin-bottom: 48px; }
.post-navigation { text-align: center; font-size: 0; line-height: 23px; }
-.post-navigation a.next-post, .post-navigation a.previous-post { display: inline-block; *display: inline; zoom: 1; vertical-align: top; width: 74px; height: 23px; line-height: 23px; color: #FFF; font-size: 12px; text-align: center; }
-.post-navigation a.next-post { background: url(../img/next-post.png) top left no-repeat; padding: 0 11px 0 4px; }
-.post-navigation a.previous-post { background: url(../img/previous-post.png) top left no-repeat; padding: 0 4px 0 11px; }
+.post-navigation a { display: inline-block; *display: inline; zoom: 1; vertical-align: top; height: 23px; line-height: 23px; text-transform: uppercase; }
+.post-navigation .next-prev { margin-bottom: 40px; }
+.post-navigation .next-prev a { width: 74px; color: #FFF; font-size: 12px; text-align: center; }
+.post-navigation .next-prev a.next-post { background: url(../img/next-post.png) top left no-repeat; padding: 0 11px 0 4px; }
+.post-navigation .next-prev a.previous-post { background: url(../img/previous-post.png) top left no-repeat; padding: 0 4px 0 11px; }
+.post-navigation .post-names { margin-bottom: 40px; }
+.post-navigation .post-names a { width: 40%; color: #ec038a; font-size: 14px; }
+.post-navigation .post-names a.next-post { text-align: left; }
+.post-navigation .post-names a.previous-post { text-align: right; }
.post-navigation img { vertical-align: top; padding: 0 7px; }
View
52 website/wp-content/themes/la/single.php
@@ -23,26 +23,52 @@
get_template_part( 'post' );
endwhile;
- ?>
+ $title_maxlen = 25;
+
+ $next_post = NULL;
+ $previous_post = NULL;
+
+ $next_post = get_adjacent_post( true, '', false );
+ $previous_post = get_adjacent_post( true, '', true );
+
+ ?>
+
<div class="post-navigation">
<div class="next-prev">
- <a class="previous-post">Previous</a>
- <img src="<?php bloginfo( 'template_url' ) ?>/assets/img/post-navigation-divider.png" />
- <a class="next-post">Next</a>
+ <?php
+
+ echo ( !empty( $previous_post ) )
+ ? '<a href="' . get_permalink( $previous_post->ID ) . '" class="previous-post">Previous</a>'
+ : '';
+ echo '<img src="' . get_bloginfo( 'template_url' ) . '/assets/img/post-navigation-divider.png" />';
+ echo ( !empty( $next_post ) )
+ ? '<a href="' . get_permalink( $next_post->ID ) . '" class="next-post">Next</a>'
+ : '';
+
+ ?>
</div>
<div class="post-names">
+ <?php
+ echo ( !empty( $previous_post ) )
+ ? '<a href="' . get_permalink( $previous_post->ID ) . '" class="previous-post">' .
+ ( strlen( $previous_post->post_title ) > $title_maxlen
+ ? substr( $previous_post->post_title, 0, $title_maxlen ) . '...'
+ : $previous_post->post_title ) .
+ '</a>'
+ : '';
+ echo '<img src="' . get_bloginfo( 'template_url' ) . '/assets/img/post-navigation-divider.png" />';
+ echo ( !empty( $next_post ) )
+ ? '<a href="' . get_permalink( $next_post->ID ) . '" class="next-post">' .
+ ( strlen( $next_post->post_title ) > $title_maxlen
+ ? substr( $next_post->post_title, 0, $title_maxlen ) . '...'
+ : $next_post->post_title ) .
+ '</a>'
+ : '';
+
+ ?>
</div>
</div>
- <?php
-
- //next_post_link( format, link, in_same_cat, excluded_categories );
-
- previous_post_link( '%link', __( '<span class="meta-nav">←</span> Previous', 'twentyeleven' ) );
- echo ' | ';
- next_post_link( '%link', __( 'Next <span class="meta-nav">→</span>', 'twentyeleven' ) );
-
- ?>
</div>
<?php
Please sign in to comment.
Something went wrong with that request. Please try again.