Making a Killer wp_link_pages

Your pagination links are wrapped in with this tag <p class=”pagelinks”> so giving them all the same spacing is easy using CSS like so: .pagelinks a { margin: 0 5px !important; } /* override other defined margins */ maybe you want them all centered on the page too: .pagelinks { display:block; text-align:center; } making the … Read more

wp_link_pages appearing after post content and not at bottom of page

Your call of wp_link_pages displays navigation immediately because echo argument is set to 1 by default, and it means to echo result. So try to add &echo=0 at the ennd of wp_link_pages call: add_filter (‘the_content’, ‘pagination_after_post’,1); function pagination_after_post($content) { if(is_single()) { $content.= ‘<div class=”pagination”>’ . wp_link_pages(‘before=&after=&next_or_number=next&nextpagelink=Next&previouspagelink=Previous&echo=0’) . ‘</div>’; } return $content; } Read more about … Read more

How can I display wp_link_pages before a shortcode, if it is used, or display after content?

Do something like this. // your shortcode callback function your_sc_callback($atts,$content) { $content = wp_list_pages(array(‘echo’=>false)).$content; define(‘YOUR_SC_RAN’,true); return $content; } Now, in your theme template after the content prints if (!defined(‘YOUR_SC_RAN’)) { wp_list_pages(); } Or, you could do … function append_list_pages($content) { return $content.wp_list_pages(array(‘echo’=>false)); } add_filter(‘the_content’,’append_list_pages’,100); And your shortcode callback would be … function your_sc_callback($atts,$content) { $content … Read more

Add wp-link-pages to post

I am answering my own question. Here is the javascript that I wrote which works 100% smooth. <script> $(document).on(“scroll mousedown DOMMouseScroll mousewheel keydown”, function (e) { if (e.which > 0 || e.type === “mousedown” || e.type === “mousewheel”) { $(‘html,body’).stop(); } }); pageSize = 1; showPage = function(page) { $(“.comix”).hide(); $(“.comix”).each(function(n) { if (n >= … Read more

using globals from wp_link_pages function

I think I figured it out. Most of WordPress is based on global variables. Even the main loop is pulling a giant global variable. So I guess it’s ok since I’m not modifying the actual values here – just pulling it out. It might not be a bad idea to throw $numpages and $page into … Read more

Linking images in WordPress Paginated Post

_wp_link_page() returns a HTML string and not just the URL address of the link. So, if the link’s URL address is http://example.com/blah/2/, then _wp_link_page() would return: <a href=”http://example.com/blah/2/”> ..i.e. it returns the opening a tag for that link. So replace the following: $content = preg_replace(‘/(<img(.+?)\/>)/i’,'<a href=”‘.$link.'”>$1</a>’, $content); ..with this: $content = preg_replace(‘/(<img(.+?)\/>)/i’, $link . ‘$1</a>’, … Read more