This is our first public plugin that we put up on the WordPress plugin directory.



What is it?

Instead of using so many page numbers on your post page or having next and previous links, this plugin handles the pagination with a much more organized way. In the name version, you get an admin panel with the ability to change the number of pages that shows, whether you want to show the dropdown or not and also you can choose to show the navigation panel if there is only one page or not.


Screenshots




How to use

All you need to do is upload the plugin to your plugins directory just like any other WordPress plugin. Then you need to add the following line to your single.php for paging your posts and page.php for your paging your pages.

<?php mysinglepages(wp_link_pages(array('before' => '', 'after' => '', 'next_or_number' => 'number','echo' => '0'))); ?>

Pretty much all you need to add is mysinglepages() function around your page links function.


Download





Related Posts

  1. Hi,
    I have implemented the pluging on http://delhi-masterplan.com/news-articles/. this is awesome. I was trying to get something like this since long. But I have one issue since I have about 33 pages in it, is there any way to display (page 2 of 33) means current page & total page? It would be really helpful. Thanks

      1. Thank you for your comment. It is definitely something we can implement in the next version of the plugin.

  2. I don’t understand something. In the installation instructions it says put in your post. I did this and it shows 2 pages now… but the same post.

    Tell me how to use this correctly please.

    I installed the plugin. Then opened single.php and pasted the code in under the content column. It shows only 1 page. There are 50 posts and they’re not linked together. How do I do this?

      1. It does pagination in your post not page your posts into one whole post.

        For example, if you have one long post and you put the “” in the middle of the post, you will have two pages in that post.

  3. Hi Admin…
    I also not understand. I’m already install plugin. but can’t. I don’t know where need to put This line ”, ‘after’ => ”, ‘next_or_number’ => ‘number’,'echo’ => ’0′))); ?> . Pls can you show step by step with picture. Thanks

      1. In your code look for the line that starts with wp_link_pages(. Now replace that line with the code above in the plugin.

        If you don’t have that line in your single.php look for the line that has and after the end of its div “” put that line.

  4. I put already that line at single.php and page.php of my site but still not appear. What should i do again? Pls help me.

      1. In the administration panel of your website check to see if the plug in is disabled when there is only one page.

        Also, what kind of a permalink structure are you using?

  5. Hello Admin…
    I changed to “Yes” at Always Show Navigation but still not appear. http://kminsw.fileave.com/sinde.png I’ll try again.

  6. Hi Admin,
    This is my site. thanks

  7. In your single.php put the function right after the following line.

    That should work.

  8. I put already in single.php but still can’t. By the way, just now I used Pages plugin on my site that About and Image. When open About and Image, appear [previous 1 next]. Why not function like that on Front page displays? Pls check on my site and help me how should be do again. Thank a lot for your helpful.

  9. I see the plugin is displayed at the wrong spot and that’s why its appearing on the top of the page all the way top. You need to put the function in the right place to see it under the post.

  10. Interesting Blog with a good layout, keep up the good work.

  11. i inserted the line in both.php page and sigle.php and can’t see any page numers, help please

  12. i got it, never mind

  13. Plugin “Number my post pages” ver. 1.2. made my pages:

    1 2 3 4 5 6 7 8 9 10 11 12 13 …

    How I can made number of pages like this:

    01 02 03 04 05 06 06 08 09 10 11 12 13 …
    ?
    I have Wordpres 2.9.2. PHP 4.4.9.

    Thank you

      1. On line 241, there is this string $resultsarr[$a]['number'], Replace that with the following, it should do the trick;

        str_pad($resultsarr[$a]['number'],2,”0″,STR_PAD_LEFT)

  14. Thank you very much. It works !

  15. I’m really thankful that you created and are sharing this plugin because it’s exactly what I’m looking for. I’m just trying to make it work now.

    I have the same issue with it displaying only 1 page when it should list multiple pages. I tried researching but no avail.

    My permalinks are structured /year/month/post-title.

    I greatly appreciate your help.

  16. Im assuming you have the nextpage tag in your post ? When you put the following function by itself, do you see the page numbers?

    wp_link_pages(array(‘before’ => ”, ‘after’ => ”, ‘next_or_number’ => ‘number’,'echo’ => ’0′))

  17. Charles says:

    Hello. I really like your plug-in. Just one question.
    In the default mode, the dropdown menu appears with the word “Page” above it.
    The dropdown also lines up 1 line below the left side. How can I make the word “Page” appear immediately to the left of the dropdown and everything line up nicely on the same line?

    I am probably missing the very obvious here.

      1. Do you have float:none or display: block for your select fields in your main stylesheet?

        1. I haven’t checked the css problem yet but noticed something else more important. Any theme I use brings up the following problem:

          Page one initially appears when the article is clicked from the home page, but after forwarding through the pages afterwards it will not page back to the first page. It will stop at page 2.

          I have to use the default wordpress function that I have included on the top of my page to go to page 1.

          1. Page is on a new line because the select right next to it doesn’t have float:left and its width is set to 100%.

            As to No 1 link, it looks like a bug in the code. Ill take a look at it.

  18. hi,
    i’m using your plugin for the new look i’m getting ready for my site.
    i’m right now checking and validating before uploading the theme, and i’m getting this error related to your plugin… could you help me fix it please?
    i think you can find all the info about it on this link:
    http://validator.w3.org/check?uri=http://test.layabozi.com/wordpress/category/columns/articles-interviews/article/&charset=(detect+automatically)&doctype=Inline&ss=1&outline=1&group=1&No200=1&st=1&user-agent=W3C_Validator/1.767#line-241


    Line 241, column 80: Opening and ending tag mismatch: div line 241 and ul
    …ass=”page_info”>Page 1 of 1« Earlier<li class=…
    Line 261, column 6: Opening and ending tag mismatch: body line 80 and div

    Line 278, column 7: Opening and ending tag mismatch: html line 3 and body

    end tag for element X which is not open ✉
    The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

    If this error occurred in a script section of your document, you should probably read this FAQ entry.

    Line 241, column 220: end tag for element “ul” which is not open
    …ss=”paginate”>1More Recent»

    THANKS!!!!!!!!!!!!!!

      1. Ill do an update on the code and submit it to WordPress directory, you will be able to update the plugin today or tomorrow.

        1. thanks! for that.
          now also i’m installing the new look on my site, and i’m also realizing that i don’t get the plugin to show more than “1″ page on the list of pages. as has been mentioned here before. the tag on the php files is ok, and all it’s set right on the plugin settings, as you’ve explained.
          would you please help me with this? i need to have the site working for monday :/ sorry for the pressure. :(

  19. hi! thanks for your reply, and i sorry the late answer, (time difference i guess, i just woke up ) … do i need to add inside every post? and that sounds like will cut the posts in pieces, and i want to number the pages for the roll of posts, so now i’m wondering maybe i made a mistake and that’s what your plugin does, instead of numbering the pages for the loop of posts… i’m confused now.
    good sunday for you!

  20. Well the tag initially splits a post into pages, it is part of the WordPress Core functionality and then my plugin shows the page numbers in a more organized way. Normally you would see all the page numbers, so like if you have 100 pages, you’d see the page links from 1 to 100.

      1. hi Ali!
        well, it’s good to know i was not mistaken about what your plugin does (pheeew :) )
        so, then it should show the numbers of the pages to navigate on the loop, and the loop of categories. but it’s not showing more than 1 page, when i have hundreds of posts, so i should have at least 30 or 40 pages to surf on.
        now the tag to split posts, i haven’t used it, i don’t want to do have the posts divided in pages. each post in on page is alright for me.
        if u send me your email, i could add u to my users, to check on your plugin. we are ‘under construction’, so unless you are login, u won’t be able to see your plugin in action.

        thanks for your attention Ali.
        Have a good monday!

  21. Like I said, without the tag you will only have 1 page. The tag is the only way to wordpress has determine where to split your post.

  22. Did you figure out why yet the plug-in will not re-curse back to page 1 yet?

    Here is the example:
    http://charlesasullivan.ca/196/origen-on-the-gift-of-tongues/2/

    Try to go back to page 1. It won’t.

    WordPress 2.9.2

      1. I couldn’t recreate the problem on my system. Does the links work fine if you put the following code in your single.php;

        wp_link_pages(array(‘before’ => ”, ‘after’ => ”, ‘next_or_number’ => ‘number’,'echo’ => ’0′))

  23. (site not public yet. still developing)

    Hi. I am using WP 3.0 and Atuahalpa theme version 3.5.1.

    I installed your number-my-pages plugin, and though it worked fine, I have changed my mind and would like to uninstall. However, if I do, every page generates the error message “Fatal error: Call to undefined function mysinglepages() in /home/illogica/public_html/letstalk/wp-content/themes/atahualpa351/functions/bfa_postinfo.php(593) : eval()’d code on line 1″. Will only go away if I reinstall and reactivate your pluging.

    Please can you help me uninstall your plugin.

    Thanks

    Jon Trevor

  24. I added no code manually.

    I have looked in bfa_postinfo.php and that line does not exist anywhere.

    Any further suggestions?

    thanks

    jon

  25. Atahualpa 3.5.1. doesnt’s seem to use a single.php or a page.php. As far as I can tell it keeps everything in its index.php.

    Needles to say, I have looked in there as well and not found the rogue code.

    Still looking.

    Jon

  26. I haven’t seen that theme so I don’t know which file it should be in but where ever you put that function, you need to take it out from there.

  27. please re-read my earlier post. I did not put the function anywhere. I just activated the plugin. If the script was put somewhere, your plugin put it there. Now I can’t find it, and can’t uninstall your plugin without breaking all my posts.

    Please advise.

    Jon

  28. Ali

    I’m not sure how else to say this clearly. My blog was working perfectly. I downloaded your plugin. I followed your instructions and copied the files to my /themes directory. I then actived the plugin, also as per your instructions. I did nothing else. I wrote no code. I edited no files.

    Your plugin worked fine. It still works fine. But I decided I don’t like it. I de-activated it. Now every post generates the error I sent you. When I re-activate it, the error goes away. I don’t see how my theme has caused this problem. It is linked directly to the installing of your plugin. Somewhere along the line the activation has added some code to a file, and now my blog won’t run without your plugin, which I don’t actually want.

    Your suggestion that the answer lies with Bytes For All support is disengenous to say the least.

    jon

  29. sorry, correction, i downloaded it to my /plugins directory

      1. Ok my plugin would not work if you didn’t add the function to any file. If you look at the instructions that’s how it says the plugin works.

        Then you need to add the following line to your single.php for paging your posts and page.php for your paging your pages.

        My plugin do not add any code in any file. It is written that way. Your theme has options and settings which I do not know about and will not be able to help you. When you disable the plugin, it only is disabled through WordPress backend.

  30. I did not write any code. I did set some options using the Settings/My Number Post Pages menu. Could this have generated some code?

    The plugin is working fine. You can see it in action at the webiste address I gave you.

    jon

  31. From your error it says that the function is trying to be called but since you removed the plugin it doesn’t exist so it’s failing. The code has to be included somewhere. Do a search in all your files for mysinglepages

      1. Well, I’ve searched every file on the site for “mysinglepages” and the only one that showed up was your own readme.txt, which of course contains the phrase.

        I am completely baffled and frustrated.

        Jon

        1. I too had a number of problems with Number My Post and later found out it had more to do with my tinkering with other WordPress php files. This in turn disrupted the proper operation of Number My Post. It forced me to do a clean install of WordPress and it worked perfectly after that.

          This may not be the answer to your situation, but this is what solved it for me.

          1. Hah! Found it. It was in the footer code held by Atahualpa, but not actually added to footer.php. Code removed, plugin deactivated, all good.

            phew!

  32. Clarissa says:

    Hi!
    I want to show 4 posts by page, but I see all posts at only one page. I inscrease the code “wp_link_pages(array(‘before’ => ”, ‘after’ => ”, ‘next_or_number’ => ‘number’,’echo’ => ’0′))” at index.php. Can you help me?

      1. This script divides the post it self not posts all together. WordPress already has that functionality if you go into your Settings > Reading, you will see it.

  33. Hello. I installed the plugin and got it up and running with no problems. I can see the page numbers and they work. However, they appear below two plugins that I also run (one is called AddtoAny and the other is called SexyBookmarks). Essentially when the post ends and is ready to go to the next page, it displays the sharing programs and then below that it displays the pagination. I need it to be above those sharing programs. I have moved it around within the single.php but I cannot get it to appear below the post but above those. I can only get it to appear at the very top of the post or below those plugins. I am assuming it is because I need it within the content() somehow but I am very new to this and understand no PHP whatsoever. Additionally I could be placing it wrong. Do you have an idea on how to get it above those two plugins?

    P.S. I know you said to replace the previous post and next post codes but I actually prefer to keep those so I am hoping to keep those. If you view my post that currently has two pages and is paginated, you will see what I mean. The link is http://www.truthlighthouse.com/featured/how-to-study-the-bible/

      1. Ya I see what’s going on. I’m afraid those plugins add themselves to the content() so they display as part of the post. You can try the following code and see how it works;


        $content = get_the_content();
        $pagelinks = mysinglepages(wp_link_pages(array('before' => '', 'after' => '', 'next_or_number' => 'number','echo' => '0'))).'<div class="shr';
        $content = str_replace('<div class="shr',$pagelinks,$content);
        echo $content;

        I'm not sure if this would work, but in theory it should. I didn't test it.

  34. Thanks so much for your prompt reply. I was unable to get that to work but I think it is because I did not know where to put it. Below is my code for single.php. You can see the original line in it. What exactly do I replace?

    Thanks again!

    ”, ‘after’ => ”, ‘next_or_number’ => ‘number’,'echo’ => ’0′))); ?>

    This entry was posted
    post_date) – (60*120)); echo time_since($entry_datetime); echo ‘ ago’; */ ?>
    on and is filed under .
    You can follow any responses to this entry through the feed.
    comment_status) && (‘open’ == $post->ping_status)) {
    // Both Comments and Pings are open ?>
    You can leave a response, or <a href="” rel=”trackback”>trackback from your own site.
    comment_status) && (‘open’ == $post->ping_status)) {
    // Only Pings are Open ?>
    Responses are currently closed, but you can <a href=" ” rel=”trackback”>trackback from your own site.
    comment_status) && !(‘open’ == $post->ping_status)) {
    // Comments are open, Pings are not ?>
    You can skip to the end and leave a response. Pinging is currently not allowed.
    comment_status) && !(‘open’ == $post->ping_status)) {
    // Neither Comments, nor Pings are open ?>
    Both comments and pings are currently closed.

  35. AH! It cut off the code. How do I post it on this forum? lol. You can email me if you like.

    Thanks

  36. Kalıcı bağlantılar /%category%/%postname%.html şeklinde

    htaccess dosyası

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    şeklinde.

    doğru şekilde plugini yükledim ancak linkler post sayfasında görünmesine rağmen tıkladığımda bir değişiklik olmuyor. ??????????

  37. Hi )

    I speak English badly.

    On the category page in the loop, the plugin does not work properly.

    code 199 line.

    http://my-wordpress.ru/blog/web-razrabotka/ispravlenie-baga-v-plagine-number-my-post-pages-v-kategorii.php

  38. its not works in my blog why ?
    plz visit my web ,maybe somethung deferent with my theme..i hav 2 single.php where i must located ? and where i must paste your script..plzzzzz help me

    this my single.php in wp-content/themes

    <div id=”post-”>

    <a href="” rel=”bookmark”>

    /* */

    <a href="” rel=”bookmark”>

    <?php
    printf( __( 'Published on: %1$s‘ ), ” );
    the_time( get_option( ‘date_format’ ) );
    ?>

    :

    ”, ‘after’ => ”, ‘next_or_number’ => ‘number’,'echo’ => ’0′))); ?>

    ______________________________________________________________

    and this my single.php in /wp-content/themes/fastfood
    ______________________________________________________________

    <?php the_tags( 'Tags: ‘, ‘, ‘, ”); ?>
    Posted in

  39. Ok, so I installed your plugin. I copied and pasted that line to my “single.php” & “page.php” and I fixed the settings to where it will show the pagination on my posts. Now, I’m not sure where to go next. How can I get the pagination to show more pages other than just 1? I don’t know how that works. Do I need to add a code somewhere on my post or something? Help.

  40. Hello, I have download and installed your plugin on my website, and put the code in both single.php and page.php.

    However when i add in my posts, i can not get the page menu to show.

    I must admit, I couldn’t find

    ”, ‘after’ => ”, ‘next_or_number’ => ‘number’,'echo’ => ’0′))?>

    at all in any of the code, for my site.

    I don’t know if i’m adding the right code into my posts, for the post to be split into separate pages, or why its not showing.

    Any help would be great.

    Thanks for all your hard work, mate.

  41. We have added the script you suggested to single.php and page.php , while we could see it in page.php, we can’t see it at Single.php [but it's their when single post is read and we enable Yes for even if one page is their]. But, I need it at our HOME page. If you can kindly go through our HOME [www.chimalaya.org] and suggest that where this CSS needs to be placed that will be of great help. Our HOME page setting can only accomodate 6 Latest NEWS items, we want that people can further see the old one. Which is not possible in present situation.

  42. Can you kindly suggest alternate plugin for this. Sorry to trouble you.

Leave a Reply