Wordpress paging without plugins

webdesign

Well-known member
Joined
Jul 5, 2012
Messages
120
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
Registered
Joined
Aug 1, 2012
Messages
7
Points
0
Thanks for this tip! I'm going to be bookmarking this, so I can reference to it in the future.
 

Ari johnson

Member
Registered
Joined
May 6, 2013
Messages
16
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
3
Views
3,754
Replies
1
Views
2,440
Replies
0
Views
2,326
Replies
0
Views
2,277
Newer Threads
Replies
0
Views
3,830
Replies
0
Views
2,514
Replies
4
Views
3,480
Replies
4
Views
3,173
Latest Threads
Replies
0
Views
122
Replies
1
Views
77

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

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