Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8772829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:07:52+00:00 2026-06-13T18:07:52+00:00

I have the wp-navi plug in working smoothly on any category that uses the

  • 0

I have the wp-navi plug in working smoothly on any category that uses the global reading config (post per page “3”), but i have one category that i only need to show 1 per page, setting this value manually outside the loop destroys my paged links, it generates a lot of pages (instead of two, since i only have two posts) and they take to the home ( i guess is some sort of 404), i’ve tried with as many solutions i could find in stackoverflow and google, and no luck yet, i’ve been using wp for a couple weeks so im not sure if im doing something really stupid here, so please help me out.

Here is the code:

<?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; 

    //query 1 post
    query_posts("posts_per_page=1&paged=$paged");       
?>
<?php while(have_posts()) : the_post(); ?>
    <div class="entry"> 
        <div class="single_entry">
            <p>
                <?php the_content(); ?>
                <div class="clear"></div>
            </p>
            <?=get_social(); ?>
            <div class="clear"></div>
        </div>
    </div>
<?php endwhile; ?>
<?php if(function_exists('wp_pagenavi')) { ?>
    <div id="pagination">
        <?php wp_pagenavi(); ?> 
    </div>
<?php } ?>

Thanks in advance =).

EDIT:
I found something interesting, if i set the &paged=2 it actually shows the second page, and the page-navi says “page 2 of 2” but only if the url stays like this “mysite.com/category/” if i add “/page/2/” to the end, it redirects me to the broken home page. So even if the pagenavi works, the “/page/#/” is breaking it, of course the get_query_var('paged') or get_query_var('page') will return its default “1” since i’m not using the “/page/” structure, maybe i could do a fix by adding a ?p=# when i click in each number of the pagenavi, not quite sure how to do that in the plugin file, so i hope you guys could help me out based on what i’m saying now, if not, well i’ll try to see how i fix this the ugly way. Thanks in advance again.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:07:54+00:00Added an answer on June 13, 2026 at 6:07 pm

    Ok i fixed this issue using js/jq i would rather find a fix using the wp codex but everything i’ve tried has been useless and i need it to solve this no matter how, besides i’m not sure how these permalinks work internally, and editing the pluging was kinda disastrous, adding a “&p=2” to the url was making the same damage as the “/page/2” so i created a script with jq to remove the links from the pagenavi, get their target page, adding an onclick to each one and passing the target page number as an argument, to later replace a hidden value on a form and sending the form, then retrieving the page number and adding it to the query_posts, it works like a charm, but i wish i knew how to do a proper fix in wp, or if it is a bug i think i must submit a ticket. Thanks for your help, if anyone have more ideas are welcome, if somebody have the same issue feel free to use this fix.

    <form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post" id="change_page">
        <input name="target_page" type="hidden" value="1" id="target_page" />
    </form>
    <script type="text/javascript">
        function go_to_page(target_page){
            var page = target_page;
            $("#target_page").val(page);
            $('#change_page').submit()
        }
        $(".wp-pagenavi").find("a").each(function(){
                var page = $(this).attr("href");
                page = page.slice(-3);
                page = page.replace("/","");
                page = page.replace("/","");
                // The if below, only apllies to the first link, since it doesn't use "/page/#" structure. 
                if(isNaN(page)) { page = 1; } 
                $(this).attr("href","javascript:void(0)");
                $(this).attr("OnClick","go_to_page("+page+")");
                console.log(page);
        });
    </script>
    

    And on top of the page i use this:

    if(isset($_POST["target_page"])) {
         $page = $_POST["target_page"];
    } else {
        $page = 1;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

have 2 questions : A computer with 32-bit address uses 2-level page table (9
I have a top nav that extends across the page Within that top nav
i have an app that uses a navbar. What i want to acomplish is
I have some code on a php page that gets an image filename strips
Example Page: http://kian02.comlu.com/kian3.html I want the Navi in the example page to have mouseover
Have some div elements on a page that I need to hide by default
Have a Ruby on Rails app that uses BCrypt to hash passwords, the User
I have make a new dropdown navi in css . Chrome, firefox, safari is
Have done quite a bit of searching for a guide (of any substance) for
Have a painfully simple blog Post creator, and I'm trying to check if the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.