Ask your WordPress questions! Pay money and get answers fast! (more info)

pagination dropdown not working! WordPress

  • SOLVED

Hi all, working for a client with a site on wordpress. The people who built it did something wrong with the pagination. As they have gone incognito, I'm asking any of you for help.

Live preview: http://auralight.com/whats-on/

When clicking the button "more awesome news" 10 more news items are indeed loaded, only they are the same that is already showing. Click it one more time and the next 10 news shows.

I've attached the code.

Thanks in advance for the help.

Answers (2)

2013-01-16

Dbranes answers:

hi, the problem might bet that the "More awesome news" link, points to

[[LINK href="http://auralight.com/whats-on?page=4"]]http://auralight.com/whats-on?page=4[[/LINK]]

instead of

[[LINK href="http://auralight.com/whats-on?paged=4"]]http://auralight.com/whats-on?paged=4[[/LINK]]

so you should try to replace <strong>page</strong> with <strong>paged</strong>, i.e. try replacing this

<a href="<?php echo "{$current_url}?page=" . ( $page + 1 ) ?>" id="load-news" class="red-button" data-type="<?php echo $archive_type; ?>" data-id="<?php echo $archive_id; ?>" data-current-qty="<?php echo $archive->get_current_qty(); ?>" data-total="<?php echo $archive->get_total(); ?>">
<span><?php _e( 'More awesome news', 'auralight' ) ?></span></a>


with this:

<a href="<?php echo "{$current_url}?paged=" . ( $page + 1 ) ?>" id="load-news" class="red-button" data-type="<?php echo $archive_type; ?>" data-id="<?php echo $archive_id; ?>" data-current-qty="<?php echo $archive->get_current_qty(); ?>" data-total="<?php echo $archive->get_total(); ?>">
<span><?php _e( 'More awesome news', 'auralight' ) ?></span></a>


LeTune comments:

I changed page to paged and the button still loads the same posts, looking in firebug the link has been corrected. Cllicking the link in firebug takes me to page to. But clicking the button still generates the same posts!

We're getting closer


Dbranes comments:


maybe there is a problem with:

data-current-qty="<?php echo $archive->get_current_qty(); ?>"



if you change this in firebug from 0 to 10 or 20, does it work then?


Dbranes comments:

the code is in

http://auralight.com/wp-content/themes/auralight/static/js/default.js?ver=3.5

/* * * * * * * * * * * *
* Load more news
* * * * * * * * * * * */
$('#load-news').click(function (evt) {
var $self = $(this),
type = $self.data('type'),
id = $self.data('id'),
current_qty = $self.data('current-qty'),
total = $self.data('total'),
get_data = {
'action' : 'get_news',
'nonce' : null,
'type' : type,
'id' : id,
'offset' : current_qty
};


LeTune comments:

it works! Dbranes you the man :)

2013-01-16

Arnav Joy answers:

can you share code , please?


LeTune comments:

<?php
global $wp, $post;

$page = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$archive = new AL_News_Archive( $page );

$current_url = home_url( $wp->request );

if ( is_day() )
{
$archive_type = 'day';
$archive_id = get_the_date( 'Y-m-d' );
}
elseif ( is_month() )
{
$archive_type = 'month';
$archive_id = get_the_date( 'Y-m' );
}
elseif ( is_year() )
{
$archive_type = 'year';
$archive_id = get_the_date( 'Y' );
}
elseif ( is_category() )
{
$archive_type = 'category';
$archive_id = get_query_var( 'cat' );
}
elseif ( is_tag() )
{
$archive_type = 'tag';
$archive_id = get_query_var( 'tag_id' );
}

?>

<ul class="news-list">
<?php foreach ( $archive->load_news( $archive->get_current_qty() ) as $post ) :
setup_postdata( $post );
?>
<li class="news-item">
<div class="content">
<div class="figure">
<?php the_post_thumbnail(); ?>
</div>
<div class="news-text">
<h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<p>
<span class="news-categories"><?php the_category( ', ' ); ?></span> |
<span class="news-date"><?php the_time( 'l, F j, Y' ); ?></span>
</p>
<p>
<a href="<?php the_permalink(); ?>" class="textlink">
<span class="news-excerpt"><?php echo get_the_excerpt() ?></span>
</a>
</p>
</div>
<div class="news-footer">
<!-- <span class='st_sharethis' displayText='ShareThis' st_url="<?php the_permalink(); ?>" st_title="<?php the_title(); ?>"></span> -->
<div class="news-share">
<span class='st_facebook' st_url="<?php the_permalink(); ?>" st_title="<?php the_title(); ?>"></span>
<span class='st_twitter' st_url="<?php the_permalink(); ?>" st_title="<?php the_title(); ?>"></span>
<span class='st_linkedin' st_url="<?php the_permalink(); ?>" st_title="<?php the_title(); ?>"></span>
<span class='st_email' st_url="<?php the_permalink(); ?>" st_title="<?php the_title(); ?>"></span>
<span class='st_sharethis' st_url="<?php the_permalink(); ?>" st_title="<?php the_title(); ?>"></span>
</div>
<div class="news-info">
<p>
<strong class="comments-number"><?php comments_number( '0 comments', '1 comment', '% comments' ); ?></strong>
<a class="comments-link" href=" <?php comments_link(); ?> ">(show)</a>

<span class="news-tags"><?php the_tags( '<strong>' . __( 'Tags:', 'auralight' ) . '</strong> ', ', ' ); ?></span>
</p>
</div>
</div>
</div>
</li>
<?php endforeach; ?>
</ul>
<?php if ( $archive->get_current_qty() < $archive->get_total() ) : ?>
<div class="footer-button">
<a href="<?php echo "{$current_url}?page=" . ( $page + 1 ) ?>" id="load-news" class="red-button" data-type="<?php echo $archive_type; ?>" data-id="<?php echo $archive_id; ?>" data-current-qty="<?php echo $archive->get_current_qty(); ?>" data-total="<?php echo $archive->get_total(); ?>">
<span><?php _e( 'More awesome news', 'auralight' ) ?></span>
</a>
</div>
<?php endif; ?>


Arnav Joy comments:

what code or plugin you have used for displaying result on click on load more button?


LeTune comments:

none that I am aware of. Would it be wp och jsplugin?


Arnav Joy comments:

i do not think so it is this plugin


LeTune comments:

Here's whats installed. See attached image