wpSight: Add Custom Listing Pagination
<?php
/**
* Init Early
*/
add_action( 'init', 'early_init' );
function early_init() {
// remove default pagination
remove_action( 'wpsight_listing_widgets_after', 'wpsight_do_listing_navigation' );
}
/**
* Add Custom Pagination
*/
add_action( 'wpsight_listing_widgets_after', 'custom_do_listing_navigation', 10 );
function custom_do_listing_navigation() {
if( ! is_listing_single() )
return;
$args = array(
'in_same_cat' => false,
'excluded_categories' => false
);
$args = apply_filters( 'wpsight_do_listing_navigation_args', $args );
// Extract $args
extract( $args, EXTR_SKIP );
$previous = get_adjacent_post( $in_same_cat, $excluded_categories, false );
$next = get_adjacent_post( $in_same_cat, $excluded_categories, true );
if( ! empty( $previous ) || ! empty( $next ) ) {
$navigation = '<div class="post-navigation clearfix">';
if( ! empty( $previous ) )
$navigation .= '<div class="previous"><a href="' . get_permalink( $previous->ID ) . '" title="">← ' . __( 'Previous Property', 'wpsight' ) . '</a></div>';
if( ! empty( $next ) )
$navigation .= '<div class="next"><a href="' . get_permalink( $next->ID ) . '" title="">' . __( 'Next Property', 'wpsight' ) . ' →</a></div>';
$navigation .= '</div><!-- .post-pagination -->';
echo $navigation;
}
}