WP Paging2010-01-16 @ 14:47
Många idag har svårt att betala sina räkningar. Då kan en lösning vara att låna pengar gratis. Ja, du hörde rätt, det är möjligt att göra det första gången. Företagen knyter på så sätt till sig kunder och du slipper ränta och andra avgifter.
WordPress has no built in paging function with numbers for themes. It’s good for users to know how many posts there are and even go to the last one. It’s good for SEO as well.
Unlike many other page navigation plugins, this one is based on a core page number function called paginate_links. WordPress use this function for the page numbers in wp-admin. If it’s good enough to use in WordPress core, it’s good enough for everyone else, right?
There are no paging themes (like WP Page Numbers). Instead you can modify the current style in many ways.
- Birth date: 2009-08-26
- Last updated: 2009-08-28
- Version: 1.2
- Tested with:
- WordPress: 2.8.4
- WordPress MU: 2.8.4 + Buddypress (Thanks to Joe Mark for testing)
- Requirements: PHP5
- Download from: devdevote.com
- Download from: wordpress.org (coming soon)
There are only one theme, but you can change that theme in many ways (about 155 520 possible combinations).
- Live preview – Click on the page numbers to try it out, right from the admin.
- Texts – Change all the texts except for the numbers. They will still be numbers.
- Layout – Change positions and how to display the page numbers.
- Positions – Change positions of page info and the whole paging navigator, align center included.
- Side numbers – Change the number count on the sides.
- Colors - Change colors of background, current background and behind text.
- CSS3 – You can even add gradients and round corners for those who use modern browsers. Internet Explorer is not one of them.
- Enable style – You can disable styles if you want to add an own style in your theme instead.
- Delete settings - If you for some reason need to install this plugin you can delete the saved settings.
The admin settings.
- Upload the FOLDER ‘wp-paging’ to /wp-content/plugins/ folder.
- Activate the plugin ‘WP Paging’ through the ‘Plugins’ menu in admin.
- Add <?php wp_paging(); ?> to your theme, after the loop or between the endwhile and else.
Go to ‘Settings’ and then ‘WP Paging’ to change your settings.
- 1.2 – Error reporting where turned on. Now it’s turned off, like it should.
- 1.1 – Bugfix – The first number now link to the right place.
- 1.0 – Initial release.
- ”expecting T_OLD_FUNCTION or T_FUNCTION”. I still believe this issue occur because the use of an old PHP version.
- Version number is wrong. It says 1.0 even on this version.
Possible future features
- Use Ajax for the live preview.
- Add multiple saved styles. This can be used for different styles in different categories for examples.
- Language support with MO / PO-files.
- single.php support.
If you are an advanced user, this might interest you, if not, never mind.
Own styles and CSS
To create an own style, uncheck ”Enable styles” (above) and add your own CSS to your styles.css into your themes folder.
<ul class="page-numbers"> <li><a class="page-numbers" href="[url]">[page]</a></li> <li><span class="page-numbers current">[current page]</span></li> <li><span class="page-numbers dots">[separator]</span></li> </ul>
Some extra classes are added to the UL element to change its style, but only if ”Enable styles” is checked.
You can override the default values as well as the settings, by adding arguments with the function, when adding it to your theme.
$args = array( 'base' => add_query_arg( 'paged', '%#%' ), 'total' => $wp_query->max_num_pages, 'current' => $page, 'prev_next' => false, 'prev_text' => 'Prev', 'next_text' => 'Next', 'end_size' => 1, 'mid_size' => 2, 'show_all' => false, 'type' => 'list', 'behind_color' => 'dark', 'page_bkg' => 'bright', 'current_page_bkg' => 'cyan', 'enable_rounded' => true, 'alignment' => 'left', 'enable_gradients' => true, 'separator_text' => '...' );
<?php echo wp_paging('show_all=true&page_bkg=dark'); ?>
Problems with 404 pages (too many page numbers)
Many people seems to have problems with 404 pages with the paging plugins out there. The problem occurs when themes are using an own WP Query object for the loop. WP Paging is clever enough to accept the parameter ”total” where you can set how many pages there are.
Look for this
$my_own_query = new WP_Query();
Remember the string of your theme (like $my_own_query).
Change the string $my_own_query to the string of your theme.
- Report bugs.
- Be specific.
- Tell me your WP version.
- What did you do?
- What is your guess?
- Do you have a fix?
- Spread the word. Write about WP Paging, link to this site and so on.
- Add a comment with a link to your website where WP Paging is installed. It’s nice to see how people are use it.