Maybe this plugin can do it for you:
https://ww.wp.xz.cn/plugins/links-shortcode/
Otherwise you could write you own shortcode handler, the API is here:
http://codex.ww.wp.xz.cn/Shortcode_API
OR you could write a custom page template for your book pages. It would be based upon the usual page.php handler, with the addition of extra DIV elements, one for prior book, one for subsequent. They would have css styling to float to the bottom left and bottom right corners of the contents div. Some php code would workout which book (p=number) links to put in each.
PS: If you are not using a child theme, now is a good time to start.
Hi Ross,
I looked into the two links in your post and i’m a bit lost on what they do.
here is more precisely what I would like and if I have to type the code into the page I will do it…
the books are numbered N1 to N196,
So that’s 196 books each with their own page
at the bottom for each page will be:
Page: NCL1 NCL2 NCL3 NCL4 …Next >
and it moves along as you go further along the pages with “< Previous” added at the beginning , until you reach N196 which will then loop back to N1.
Do I need to type that out on each page, then individually add the links or is there a way in wordpress that will add this automatically to the pages?
With my posts its automatically done with a Previous and Next links that are automatically generated.
I am not versed in any professional way with wordpress of html but I can learn.
Scott
Do I need to type that out on each page, then individually add the links or is there a way in wordpress that will add this automatically to the pages?
To do it automatically, you need to be able to put code into the page template which can use the WordPress page id (the p=number), and turn it into your book number (your NCL<number>). If you can do this, then it could be done automaticall.
On the other hand, if the above is too tricky, and since it (ONLY!) involves manual edits on 196 pages (if it were thousands you couldnt do this),
FROM the API
Here’s a trivial example of an enclosing shortcode:
function caption_shortcode( $atts, $content = null ) {
return ‘<span class=”caption”>’ . $content . ‘</span>’;
}
add_shortcode( ‘caption’, ‘caption_shortcode’ );
When used like this:
[caption]My Caption[/caption]
Using a scheme like this, you edit each book page, say this is book 18 and you want to link to books 16,17,19,20 you would add a shortcode [booklink]16:145 17:190 19:161 20:162[/booklink]
Php code in the booklink shortcode function would produce output like:
<div class="bklink"><a href="/?p=145">NCL16</a>
<a href="/?p=190">NCL17</a>
<a href="/?p=161">NCL19</a>
<a href="/?p=162">NCL20</a></div>