Archived topic
insert php nav links location
7 replies · Started by theonetruevlad on November 15, 2015
I am using a PHP insertion plugin to show posts in a certain category on a certain page.
I have the page with some blurb about the category and it then shows the last 3 blog post from that category underneath.
What I want is the pagination links to appear at the bottom of the page because that is where people will be after scrolling through the posts. Unfortunately they appear at the top before the posts.
There is an extra empty section showing at the bottom of the page. Maybe this has to do with the generatepress theme option for sections?
theonetruevlad.co.uk/music/peach-beach
Inserted php:
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=33&showposts=3&paged=$page");
posts_nav_link();
Hard for me to know what's going on really.
Have you tried this plugin?: https://wordpress.org/plugins/display-posts-shortcode/
It's very well written and should do something similar to what you're looking for.
Sadly does not support pagination and does not show the whole post, only shows title with option for an excerpt.
Can you post the code you're using to a pastebin? http://pastebin.com/
Hi
http://pastebin.com/73RNi6p5
Which just these 3 lines:
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=33&showposts=3&paged=$page");
posts_nav_link();
I have tried using both these plugins to insert the php:
If I add other content this also appears before the post. It seems to be that the actual posts go after all the content has been added regardless of where you place the post call.
Could I maybe stick the code in using gp hooks with conditions for which page I am on? Then I won't need the extra plugins. Otherwise I guess I'll have to research page templates.
Hmm, nothing should be wrong with that code, but it all has to do with how and where you're adding it.
Have you added it to a shortcode that you're adding to the page? Or?
Both plugins I have tried use shortcodes.
One you enter the code on the page between [insert_php] & [/insert_php] dropping the <?php & ?> Code goes where the & is.
The other plugin you add your php (again without the <?php & ?>) in the plugins optins page (the same way you do with custom css). Then you add the shortcode that references the code eg [xyz-ips snippet="Pagination"]
Both plugins give the same result. You get all the text and the pagination buttons in the first section, then subsequent sections are posts and finally there is a blank section at the end. It is completely irrelevant which order you have the shortcodes and text on the page, it always publishes like this.
Hmm, I'm afraid I don't have any ideas on this one - I'm sorry!
Your best bet may be to create a custom page template so you have full control over the entire template.
