Wordpress paging without plugins

webdesign

New member
Joined
Jul 5, 2012
Messages
234
Points
0
In WordPress, there is no available paging function, which interfere more or less to the reader. The paging to blog gives you the blog optimization, helping the reader to easily find older articles, and over the paging button readers can express themselves know is how to find this Forum many pages, to be able to determine if the topic they are searching the blog you write more or not.

To do this, you can use the plugin WP Paganavi, however you should not take too many plugins for Blog, will not do much good for your page loading speed, especially in times of "quick wins such as today. "

Some of the following code will get you an equally competitive paging plugin and also add decoration to your blog if you know how to customize.

B1. Add the code to functions.php
Code:
wp_corenavi function () {
 global $ wp_query, $ wp_rewrite;
 $ Pages ='';
 $ Max = $ wp_query-> max_num_pages;
 if (! $ current = get_query_var ('paged')) $ current = 1;
 $ A ['base'] = ($ wp_rewrite-> using_permalinks ())? user_trailingslashit (trailingslashit (remove_query_arg ('s', get_pagenum_link (1))). 'page /% #% /', 'paged'): @ add_query_arg ('paged', '% #%');
 if (! empty ($ wp_query-> query_vars ['s'])) $ a ['add_args'] = array ('s' => get_query_var ('s'));
 $ A ['total'] = $ max;
 $ A ['current'] = $ current;
$ Total = 1 / / 1 - show "Page N of N", 0 - not shown
 $ A ['mid_size'] = 5; / / number of paging out left and right side of the current page
 $ A ['end_size'] = 1; / / number of paging begins and ends
 $ A ['prev_text'] = '«Previous'; / / the" Previous page "
 $ A ['next_text'] = 'Next »' / / text" Next page "
 if ($ max> 1) echo '<div>';
 if ($ total == 1 && $ max> 1) $ pages = "<span> Page '. $ Current. 'Of'. $ Max. '</ Span>'. "Rn";
 echo $ pages. paginate_links ($ a);
 if ($ max> 1) echo '</ div>';}
Note: Insert Mode with UTF8 encoding

B2. Add paging interface

Add the following line where you want the paging. To check the position can insert you see in the interface does not have navigation.php file, or to check the files related to paging is inserted. Often it inserted in the index.php file of the interface.
A

Code:
<? Php if (function_exists ('wp_corenavi')) wp_corenavi ();?>
B3. Beauty paging WordPress

At this point we need a little css financial aid for the beauty of your paging. Here is the css prepared by them, you customize the interface to suit:
Code:
/ * ------------------------------------------------ * /
/ * ---------------- [PageNavi] ---------------- * /
/ * ------------------------------------------------ * /
. PageNavi {clear: both; position: relative; float: right; margin-top: 35px;}
. PageNavi span. PageNavi a {color: # 4d4d4d; padding: 3px; margin-right: 5px; background: transparent; border: # 757575} 1pxsolid
. PageNavi a: hover,. PageNavi. Current {background: transparent; color: # 4d4d4d; text-decoration: none}
. PageNavi. Pages. PageNavi. Current {color: # 4d4d4d; font-weight: bold}
. PageNavi. Pages {border: none}
Add the css style.css file just then at the end of the interface. And now they do enjoy with your paging!
 

Noticed

New member
Joined
Aug 1, 2012
Messages
25
Points
0
Thanks for this tip! I'm going to be bookmarking this, so I can reference to it in the future.
 

Ari johnson

New member
Joined
May 6, 2013
Messages
19
Points
0
It's really helpful post for the WordPress Developer to make thier work easy fast. I also going to bookmark this. Thank you.
 
Older threads
Replies
4
Views
2,772
Replies
18
Views
5,976
Replies
17
Views
7,851
Replies
12
Views
5,453
Replies
4
Views
3,317
Newer threads
Replies
6
Views
3,312
Replies
0
Views
3,007
Replies
30
Views
12,115
Replies
6
Views
3,860
Replies
20
Views
9,846
Latest threads
Replies
0
Views
36
Replies
8
Views
162
Replies
0
Views
62
Replies
6
Views
150
Recommended threads
Replies
2
Views
3,254
Replies
3
Views
770
Replies
8
Views
4,300
Replies
6
Views
2,848
bob

Referral contests

Referral link for :

Sponsors

Latest Blog ArticlesMost Viewed Threads

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top