Created by
Alexandr Kostyrka
last modified
| /**
* Previous/next buttons for single portfolio
*/
function custom_portfolio_prev_next() {
$output = '';
ob_start();
next_post_link( '%link', '<span>' . esc_html__( 'Previous', 'polo_extension' ) . '<i class="fa fa-chevron-right"></i></span>' );
$next_post = ob_get_clean();
ob_start();
previous_post_link( '%link', '<span><i class="fa fa-chevron-left"></i>' . esc_html__( 'Next', 'polo_extension' ) . '</span>' );
$prev_post = ob_get_clean();
$output .= '<div class="pager pager-modern text-center">';
if ( isset( $prev_post ) && ! empty( $prev_post ) ) {
$output .= str_replace( '<a ', '<a class="pager-prev"', $prev_post );
} else {
$output .= '<a class="pager-prev disabled" href="#"><span><i class="fa fa-chevron-left"></i>' . esc_html__( 'Next', 'polo_extension' ) . '</span></a>';
}
$output .= '<a class="pager-all" href="' . get_home_url( '/' ) . '"><span><i class="fa fa-th"></i></span></a>';
if ( isset( $next_post ) && ! empty( $next_post ) ) {
$output .= str_replace( '<a ', '<a class="pager-next"', $next_post );
} else {
$output .= '<a class="pager-next disabled" href="#"><span>' . esc_html__( 'Previous', 'polo_extension' ) . '<i class="fa fa-chevron-right"></i></span></a>';
}
$output .= '</div>';
if ( is_singular( 'portfolio' ) ) {
echo $output;
}
}
function crum_replace_portfolio_navigation(){
remove_action( 'polo_content_after', 'crumina_portfolio_prev_next' );
add_action( 'polo_content_after', 'custom_portfolio_prev_next' );
}
add_action('init', 'crum_replace_portfolio_navigation');
|