Code integration for WordPress paging navigation and Bootstrap foreground effect

Source: Internet
Author: User
1. first in the topic functions. add the following code to php: functionpagenavi ($ before '', $ after'', $ p2) {if (is_singular () return; global $ wp_query, $ paged; $ max_p

1. first add the following code to the topic functions. php:

Function pagenavi ($ before = '', $ after ='', $ p = 2) {if (is_singular () return; global $ wp_query, $ paged; $ max_page = $ wp_query-> max_num_pages; if ($ max_page = 1) return; if (empty ($ paged) $ paged = 1; echo $ before.'
 
 
    '; If ($ paged> 1) p_link ($ paged-1, 'Previous page ','? '); If ($ paged> $ p + 1) p_link (1, 'homepage'); for ($ I = $ paged-$ p; $ I <= $ paged + $ p; $ I ++) {if ($ I> 0 & $ I <= $ max_page) $ I = $ paged? Print"
  • {$ I}
  • ": P_link ($ I);} if ($ paged <$ max_page-$ p) p_link ($ max_page, 'Last page'); if ($ paged <$ max_page) p_link ($ paged + 1, 'next page ','? '); Echo'
'. $ After;} function p_link ($ I, $ title = '', $ linktype ='') {if ($ title = '') $ title = "Jump to page {$ I}"; if ($ linktype = '') {$ linktext = $ I;} else {$ linktext = $ linktype ;} echo"
  • {$ Linktext}
  • ";}

    2. Then, at the corresponding location of the page, change the original paging navigation code to the following:

     

    As follows:

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.