6 replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/
source | link

Earlier, I asked this questionthis question and received a code which should work. Unfortunately, this code is not working.

Earlier, I asked this question and received a code which should work. Unfortunately, this code is not working.

Earlier, I asked this question and received a code which should work. Unfortunately, this code is not working.

    Notice removed Draw attention by AndrettiMilas
    Bounty Ended with brasofilo's answer chosen by AndrettiMilas
5 added 997 characters in body
source | link

For all relevant codes...

The original pagination code (which has been combined with prev/next)

<?php
global $wp_query;

$big = 999999999; // need an unlikely integer

echo paginate_links( array(
    'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
    'format' => '?paged=%#%',
    'current' => max( 1, get_query_var('paged') ),
    'total' => $wp_query->max_num_pages
) );
?>

The previous/next which has been combined with pagination

<?php previous_posts_link ('Newer') ?>
<?php next_posts_link('Older') ?>

The function for the theme options, chooses between pagination and next/prev links

array( "name" => "Paginate or next/previous links?", 
    "desc" => "Choose your option", 
    "id" => $shortname."_next_prev_or_paginate", 
    "type" => "select", 
    "options" => array("Next", "Pagination"), 
    "std" => "Next"), 

For all relevant codes...

The original pagination code (which has been combined with prev/next)

<?php
global $wp_query;

$big = 999999999; // need an unlikely integer

echo paginate_links( array(
    'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
    'format' => '?paged=%#%',
    'current' => max( 1, get_query_var('paged') ),
    'total' => $wp_query->max_num_pages
) );
?>

The previous/next which has been combined with pagination

<?php previous_posts_link ('Newer') ?>
<?php next_posts_link('Older') ?>

The function for the theme options, chooses between pagination and next/prev links

array( "name" => "Paginate or next/previous links?", 
    "desc" => "Choose your option", 
    "id" => $shortname."_next_prev_or_paginate", 
    "type" => "select", 
    "options" => array("Next", "Pagination"), 
    "std" => "Next"), 
4 More descriptive title. Content formatting and excerpt from previous question. Proper code indentation.
source | link

Options Panel Theme Option not Working Inside a Function

Earlier, I asked this question and received a code which should work. Unfortunately, this code is not working. The

I'm building a themes option panel and want users to be able to choose between Next/Previous links or pagination in my archives and homepage.

The code within functions.phpfunctions.php is controlling an options panel drop-down which allows the user to choose pagination or next/previous links.  

This code is displaying Next/Previous links at all times, even when I choose pagination. I need the pagination option to work too!

What I have in functions.phpfunctions.php

array( "name" => "Paginate or next/previous links?", 
    "desc" => "Choose your option", 
    "id" => $shortname."_next_prev_or_paginate", 
    "type" => "select", 
    "options" => array("Next", "Pagination"), 
    "std" => "Next"), 

What I have in archives.phparchives.php

<?php
function my_theme_navigation()  
{ 
    global $shortname; 

    if( get_option( $shortname . '_next_prev_or_paginate' ) == 'Next' ) : 
 
        // the block for next-prev navigation 
        previous_posts_link ('Newer');
        next_posts_link('Older');
    else : 
        // the block for pagination
    else : 
   global $wp_query; 
        $big = 999999999; // need an unlikely integer       
        echo paginate_links( 
            array( 
                'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ), 
                'format' => '?paged=%#%', 
                'current' => max( 1, get_query_var('paged') ), 
                'total' => $wp_query->max_num_pages 
            ) 
        ); 
    endif; 
} 
?>

Options Panel Function

Earlier, I asked this question and received a code which should work. Unfortunately, this code is not working. The code within functions.php is controlling an options panel drop-down which allows the user to choose pagination or next/previous links. This code is displaying Next/Previous links at all times, even when I choose pagination. I need the pagination option to work too!

What I have in functions.php

array( "name" => "Paginate or next/previous links?", 
    "desc" => "Choose your option", 
    "id" => $shortname."_next_prev_or_paginate", 
    "type" => "select", 
    "options" => array("Next", "Pagination"), 
    "std" => "Next"), 

What I have in archives.php

<?php
function my_theme_navigation() { 
global $shortname;
    if( get_option( $shortname .'_next_prev_or_paginate' ) == 'Next' ) : 
 
     // the block for next-prev navigation 
previous_posts_link ('Newer');
next_posts_link('Older');

        // the block for pagination
    else : 
 global $wp_query; 
$big = 999999999; // need an unlikely integer 
echo paginate_links( array( 
    'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ), 
    'format' => '?paged=%#%', 
    'current' => max( 1, get_query_var('paged') ), 
    'total' => $wp_query->max_num_pages 
) ); 
endif; 
} 
?>

Theme Option not Working Inside a Function

Earlier, I asked this question and received a code which should work. Unfortunately, this code is not working.

I'm building a themes option panel and want users to be able to choose between Next/Previous links or pagination in my archives and homepage.

The code within functions.php is controlling an options panel drop-down which allows the user to choose pagination or next/previous links.  

This code is displaying Next/Previous links at all times, even when I choose pagination. I need the pagination option to work too!

What I have in functions.php

array( "name" => "Paginate or next/previous links?", 
    "desc" => "Choose your option", 
    "id" => $shortname."_next_prev_or_paginate", 
    "type" => "select", 
    "options" => array("Next", "Pagination"), 
    "std" => "Next"), 

What I have in archives.php

<?php
function my_theme_navigation()  
{ 
    global $shortname; 

    if( get_option( $shortname . '_next_prev_or_paginate' ) == 'Next' ) : 
        // the block for next-prev navigation 
        previous_posts_link ('Newer');
        next_posts_link('Older');
    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=%#%', 
                'current' => max( 1, get_query_var('paged') ), 
                'total' => $wp_query->max_num_pages 
            ) 
        ); 
    endif; 
}
?>
    Notice added Draw attention by AndrettiMilas
    Bounty Started worth 50 reputation by AndrettiMilas
3 deleted 51 characters in body; edited title
source | link
2 added 42 characters in body
source | link
1
source | link