Home > CMS Tutorial > WordPress > body text

The simplest way to manually enter the page number and jump to the next page in WordPress

藏色散人
Release: 2021-04-06 11:31:37
forward
2097 people have browsed it

The following tutorial column of WordPress will introduce to you the simplest method of manually entering the page number and jumping to the page in WordPress. I hope it will be helpful to friends in need!

The simplest way to manually enter the page number and jump to the next page in WordPress

Users often ask if they can have a page turning function that allows them to manually input page numbers and realize jumps. It is very simple, with only four lines of code:

<form class="zm-page-nav-form" action="<?php echo $_SERVER[&#39;REQUEST_URI&#39;];?>" method="get">
<input class="zm-input-number" type="text" placeholder="" size="6" name="paged" />
<input class="zm-button" value="转到" type="submit" >
</form>
Copy after login

can be added to the appropriate location in the topic classification archive template.

The code is taken from a plug-in called smart paging: wp smart pagination. The plug-in itself has not been updated for many years. In addition to the above code, the plug-in also comes with page turning code.

Things that need to be improved: the current page number cannot be displayed, enter a page number that does not exist, cannot jump to the last page like the WP background article list, directly 404, this function has been studied many years ago, and recently I remembered it again, maybe some experts can help me improve it.

Matching style:

.zm-input-number {
background: #fff;
text-align: center;
border-radius: 2px;
border: 1px solid #3690cf;
}
 
.zm-button {
background: #fff;
cursor: pointer;
border-radius: 2px;
border: 1px solid #3690cf;
-webkit-appearance: none;
}
 
.zm-button:hover {
background: #3690cf;
color: #fff;
-webkit-appearance: none;
}
Copy after login

Can be modified accordingly according to the theme style.

This function does not feel very useful. Normal viewers will not directly skip the new article and read the following ones. It can only be said to be multiple choices.

The above is the detailed content of The simplest way to manually enter the page number and jump to the next page in WordPress. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:zmingcx.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!