With the native Theme Customization API it makes no sense to have an independent options panel. So how do I implement my code (below) into the Theme Customizer?
Here is the code for my Theme Customizer: code here
In my options panel I allow users to select between Next/Previous Links in archives or pagination, the code looks like this:
array( "name" => "Paginate or next/previous links?",
"desc" => "Choose your option",
"id" => $shortname."_next_prev_or_paginate",
"type" => "select",
"options" => array("Next/Previous Links", "Pagination"),
"std" => "Next/Previous Links"),
Here is the function that makes it work:
// Pagination
function my_theme_navigation() {
global $shortname;
if( get_option( $shortname . '_next_prev_or_paginate' ) == 'Next/Previous Links' ) :
// the block for next-prev navigation
echo '<div class="button left">';
next_posts_link('Older');
echo '</div>';
echo '<div class="button right">';
previous_posts_link ('Newer');
echo '</div>'; else :
// the block for pagination
global $wp_query;
$big = 999999999;
// need an unlikely integer
echo paginate_links( array( 'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ), 'format' => '?paged=%#%','end_size' => 1,'mid_size' => 2, 'current' => max( 1, get_query_var('paged') ), 'total' => $wp_query->max_num_pages ) );
endif;
}
I then simply call it using this:
<?php my_theme_navigation(); ?>