WordPress post/page pagination (page links) to go back to the first section

I am using the page links: https://codex.wordpress.org/Styling_Page-Links as: wp_link_pages(array('before'=>'', 'next_or_number'=>'next', 'previouspagelink' => '«', 'nextpagelink'=>'»')); I want to add an additional link, For eg: X, which upon clicking will take the user to the first section. Is it possible to achieve this using this function? Any help is much appreciated.
Category: Web

How to make the <!--nextpage--> show as a button?

So currently my blog post has a "Pages: Next page" at the bottom of my blog post by putting &lt;!--nextpage-a-&gt; in the editor where I wanted to stop the first page. Also with the &lt;?php wp_link_pages( array ( 'next_or_number' =&gt; 'next' ) ); ?&gt; in the single.php file. Now if I wanted to make the "Pages: Next Page" a button with "Next Page" instead, what should I do to achieve this? I'm not super familiar with Wordpress codex and I …
Category: Web

Help to modify wp_link_pages()

My site has the Newspaper theme by tagDiv, which installs two necessary plugins to make things work better. These plugins are Composer and Standard Pack. I'm trying to modify the default wp_link_pages() but I don't know how because one of these plugins has code that changes the function. I don't want to change the plugin file because it is frequently updated. The problem is that the code is not inside a post file like single.php. And I'm not finding a …
Category: Web

Custom wp_link_pages for paginated posts | Next page randomly

Does anyone know if it's possible to change wp_link_pages, I want to change the order of the pages Example : i have an Post consisting of 5 pages i want when you click on &quot;Next page&quot;, it takes you to a random page of the five pages that we have in the article. without repeat Any ideas/help greatly appreciated, S.
Category: Web

Paged posts - how to use numbers and next/previous links?

I want wp_link_pages (mutli-page posts) to display the page numbers, the word "previous" before those numbers, and a "next" after those numbers. It would look like this: Prev 1, 2, 3, 4 Next I'm attempting to do this without a plugin. Here's what I've tried so far, but it isn't working, it is only displaying numbers. &lt;?php wp_link_pages(array( 'before' =&gt; '&lt;span style="clear:both; display:block"&gt;Pages', 'after' =&gt; '&lt;/span&gt;', 'next_or_number'=&gt;'number', 'previouspagelink' =&gt; 'previous', 'nextpagelink'=&gt; 'Next' )); ?&gt;
Category: Web

How do I change page numbers to words?

So I need to change the page numbers to word but I can't figures out how to do it. Right now I'm using page breaks but it always looks like the example below no matter how many times I try to fix it, sigh.... Example: Instead of saying 1 2 3 4 5 I need it to say Appetizers, Salads, Combos, Sandwiches, Burgers PLEASE HELP ME!!!
Category: Web

wp_trim_words() does not work with my code Am I doing any mistake in my code?

n my WordPress website, I want to show a short text of each blog_post on the custom blog template. I want to show a Read More button with a link to the post at the end so a user can click on that link and view the full post. But I am always getting the whole post instead of its summary. Here is my code: &lt;div class="contentTitle"&gt; &lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt; &lt;/div&gt; &lt;div class="contentText"&gt; &lt;?php $readmore = '&lt;p&gt;&lt;a …
Category: Web

How to change the paginated posts link class?

When using wp_link_pages() to display article pagination, how do I modify the linked class? I want to use different classes to set the previous/next link style. Thanks in advance! Wp_link_pages() parameter: &lt;?php wp_link_pages( array( 'before' =&gt; '&lt;div class="page-links"&gt;', 'after' =&gt; '&lt;/div&gt;', 'next_or_number' =&gt; 'next', ) ); ?&gt; Html output: &lt;div class="page-links"&gt; &lt;a href="http://test.com/xxxxxx/2/" class="post-page-numbers"&gt;PREVIOUS&lt;/a&gt; &lt;a href="http://test.com/xxxxxx/4/" class="post-page-numbers"&gt;NEXT&lt;/a&gt; &lt;/div&gt;
Category: Web

wp_link_pages shortcode for 'nextpagelink'

I want 'nextpagelink' shortcode [nextpage_shortcode] that I can place inside content. I've seen threads where they say that you can't place anything related to the wp_link_pages inside content due to the way the content is rendered by Wordpress. As you can see the text of 'nextpagelink' changes depending on the slide #. I want the shortcode to reflect that. Here is the schematic of what I am looking to do: Both 'BEGIN' buttons link to the 2nd slide. This is …
Category: Web

Post Pagination Customization (wp_link_pages) Editing Navigation

I want to create a post pagination where there is only ONE 'nextpagelink' button per page. However, I want the text inside the the first 'nextpagelink' to say "WELCOME". And I want the text inside every 'nextpagelink' after that to say "NEXT PAGE". Quick Schematic I figured out the "NEXT PAGE" part: The following is inside single.php wp_link_pages( array( 'before' =&gt; '&lt;div id="slideshow"&gt;', 'after' =&gt; '&lt;/div&gt;', 'next_or_number' =&gt; 'next', 'previouspagelink' =&gt; '&lt;span id="previous" style="display:none;"&gt; PREVIOUS SLIDE &lt;/span&gt;', 'nextpagelink' =&gt; '&lt;span …
Category: Web

Linking images in WordPress Paginated Post

I have a paginated post on WordPress with about 5 pages. I want to set it up so that the images in the content from the previous page automatically link to the following page. I've used the following code in functions.php file: &lt;?php add_action('the_content',function($content) { global $page, $numpages, $multipage; if ( $multipage ) { $nextPage = $page + 1; if ( $nextPage &lt;= $numpages ) { $link = _wp_link_page( $nextPage ); $content = preg_replace('/(&lt;img(.+?)\/&gt;)/i','&lt;a href="'.$link.'"&gt;$1&lt;/a&gt;', $content); } } // send …
Category: Web

How do I detect which page I'm on within a paginated post?

I'm using wp_link_pages() to paginate a post. I want to show something below the post content only on the first page of the post. Naturally I thought I'd use get_query_var('paged') to get the page number, but it returns 1 regardless of which page I'm on. I know I could parse out the URL manually to see which page I'm on, but there has to be a built in WordPress function for this.
Category: Web

How to insert text between the page numbers?

Inside my article I use the tag &lt;!--nextpage--&gt;. Now how to insert text between the page numbers. In HTML it should look like this: &lt;div class="postlink"&gt; &lt;p style="text-align: center;"&gt;my test 1&lt;/p&gt; &lt;a rel="nofollow" href="https://domen.com/linkpost/2/"&gt; 2 &lt;/a&gt; &lt;a rel="nofollow" href="https://domen.com/linkpost/3/"&gt; 3 &lt;/a&gt; &lt;a rel="nofollow" href="https://domen.com/linkpost/4/"&gt; 4 &lt;/a&gt; &lt;a rel="nofollow" href="https://domen.com/linkpost/5/"&gt; 5&lt;/a&gt; &lt;p style="text-align: center;"&gt;my text 2&lt;/p&gt; &lt;a rel="nofollow" href="https://domen.com/linkpost/6/"&gt; 6 &lt;/a&gt; &lt;a rel="nofollow" href="https://domen.com/linkpost/7/"&gt; 7 &lt;/a&gt; &lt;a rel="nofollow" href="https://domen.com/linkpost/8/"&gt; 8 &lt;/a&gt; &lt;p style="text-align: center;"&gt;my text 3&lt;/p&gt; &lt;a rel="nofollow" href="https://domen.com/linkpost/9/"&gt; 9 /a&gt; …
Category: Web

using globals from wp_link_pages function

I'm following this reference page for wp_link_pages:https://developer.wordpress.org/reference/functions/wp_link_pages/ In it, 4 global variables are declared: $page, $numpages, $multipage, $more. I'm able to access it in my templatexxxx.php by doing this: global $numpages; global $page; echo $numpages; echo $page; My question is this: should I be doing this? I have been taught that using/accessing global is bad. But short of coding an entire function (which seems to be a bit overkill), this seems to be the fastest and easiest way to obtain …
Category: Web

Only nextpagelink on wp_link_pages

Does someone have a solution to display only the nextpagelink with wp_link_pages in single posts? I've tried different solutions, but none of it worked. As I reach the last page - wp_link_pages remove nextpagelink and show previouspagelink. But I need only nextpagelink at all pages except last one. Or maybe a solution to add class for nextpagelink? Found solution: &lt;?php global $multipage, $numpages, $page; if( $multipage &amp;&amp; $page == $numpages ) { //Do nothing } else { wp_link_pages('before=&amp;after=&amp;next_or_number=next&amp;previouspagelink=&amp;nextpagelin‌​k=More'); } ?&gt;
Category: Web

Display only the current page number and another numbered page in pagination

I need some help with pagination. The pagination should only display the current page and another numbered page, like so: &lt;&lt; | 2 | …3 | &gt;&gt; At the moment, it shows all page numbers: &lt;&lt; | 1 | 2 | 3 | …3 | &gt;&gt; Any ideas how to change this? This is the code: add_filter('wp_link_pages_args', 'wp_link_pages_args_prevnext_add'); /** * Add prev and next links to a numbered link list */ function wp_link_pages_args_prevnext_add($args) { global $page, $pages, $numpages, $more, $pagenow; …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.