Move page links on top of share buttons in Ryu

Yesterday when I published my thoughts about Freelance Web Developers Market Research, it’s the first time I wrote a 2000-word article on my blog, I thought it was a good idea to add page links to divide it into two pages.

I knew Ryu (the theme I used for this blog) had styled the page links so it should work fine. But later I found the page links showed after three blocks I’ve added with plugins – share buttons, related posts and author box. My visitors might not know there was a second page of that post.

When looked into the code I found the developer used wp_link_pages() under the_content() in content.php, but the plugins I used hooked their code to the end of the_content filter, that’s why the page links would always be displayed after them.

Here are the snippets I added to the child theme of Ryu to solve my problem.

1. Remove the wp_link_pages() from content.php

2. Hook wp_link_pages() to the_content filter in functions.php

Now it works and I’m still amazed that such a beautiful, elegant theme is free on WP.org.

I’m a senior web developer helping clients build their websites to grow businesses. Currently I’m based in Taipei, Taiwan.

I write things about WordPress, AngularJS and life. Whenever you’d like to find someone to talk about these topics, just get in touch!

Submit a comment

Your email address will not be published. Required fields are marked *