Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix archive navigation
  • Loading branch information
szk11001 committed May 18, 2015
1 parent 4c5345b commit b0cb09f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions js/custom.js
Expand Up @@ -214,14 +214,14 @@ jQuery(document).ready(function($) {
'class': 'story-navigation',
}).appendTo( $(".span8.follow-hero") );
$('<a />',{
'id': 'prevStories',
'id': 'newerStories',
'data-id': firstID,
'text': 'Previous Stories'
'text': 'Newer Stories'
}).appendTo(span);
$('<a />',{
'id': 'nextStories',
'id': 'olderStories',
'data-id': lastID,
'text': 'Next Stories'
'text': 'Older Stories'
}).appendTo(span);
storyNavCheck();
},
Expand Down Expand Up @@ -445,21 +445,21 @@ jQuery(document).ready(function($) {

function storyNavCheck(){
var firstInList = $("ul.news-archive-list").children().first().data('id');
var firstPost = $(".span8.follow-hero").children().first().data('id');
var firstPost = $(".span8.follow-hero").children('article').first().data('id');

if( firstInList == firstPost ){
$('a#prevStories').hide();
$('a#newerStories').hide();
} else {
$('a#prevStories').show();
$('a#newerStories').show();
}

var lastInList = $("ul.news-archive-list").children().last().data('id');
var tenthPost = $(".span8.follow-hero").children().last().prev().data('id');
var tenthPost = $(".span8.follow-hero").children('article').last().data('id');

if( lastInList == tenthPost ){
$('a#nextStories').hide();
$('a#olderStories').hide();
} else {
$('a#nextStories').show();
$('a#olderStories').show();
}
}
storyNavCheck();
Expand All @@ -470,11 +470,11 @@ jQuery(document).ready(function($) {

var startingElement;
var postsArray;
if( this.id == 'nextStories' ){
if( this.id == 'olderStories' ){
startingElement = element.next();
postsArray = retrievePostIDs(startingElement);
$('#news-next').trigger('click');
} else if( this.id == 'prevStories' ){
} else if( this.id == 'newerStories' ){
startingElement = element.prev();
postsArray = retrievePreviousIDs(startingElement);
$('#news-back').trigger('click');
Expand Down
4 changes: 2 additions & 2 deletions page-news-archive.php
Expand Up @@ -141,8 +141,8 @@ get_header(); ?>
wp_reset_postdata();
?>
<div class="story-navigation">
<a href="#" id="prevStories" data-id="<?php echo $firstPostID; ?>">Previous Stories</a>
<a href="#" id="nextStories" data-id="<?php echo $tenthPostID; ?>">Next Stories</a>
<a href="#" id="newerStories" data-id="<?php echo $firstPostID; ?>">Newer Stories</a>
<a href="#" id="olderStories" data-id="<?php echo $tenthPostID; ?>">Older Stories</a>
</div>
</div> <!-- span8 follow-hero -->

Expand Down

0 comments on commit b0cb09f

Please sign in to comment.