Allow Users to Choose Pagination or Next/Previous (Combine)

A simple if statement should do, so something like this:

function my_theme_navigation() {
    if( get_option( $shortname .'_next_prev_or_paginate' ) == 'Next/Previous Links' ) :
        // the block for next-prev navigation
    else :
        // the code for pagination
    endif;
}

I have no way of knowing what the array in your first code block exactly does, but I think I got it right. The only thing you’d still have to do is substitute $shortname with whatever that variable holds. If it’s a global, then just add global $shortname; to the top of the function. I am also assuming that the values of the select options are the same as the titles.

Leave a Comment