Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pajtai
Last active April 2, 2018 22:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pajtai/a25ac40a76e2c3caf657347a66cd4408 to your computer and use it in GitHub Desktop.
Save pajtai/a25ac40a76e2c3caf657347a66cd4408 to your computer and use it in GitHub Desktop.
<?php
$pagination = paginate_links( array(
'base' => get_pretty_url($currentMarket, $currentCategory) . '%_%',
'format' => '/page/%#%',
'current' => $paged,
'total' => $posts->pagination()->total,
'prev_next' => false
));
function get_pretty_url( $root, $marketSlug, $topicSlug ) {
$pretty_url = '/' . get_query_var('pagename');
if ( $marketSlug ) {
$pretty_url .= "/market/$marketSlug";
}
if ( $topicSlug ) {
$pretty_url .= "/category/$topicSlug";
}
return $pretty_url;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment