Cyber Week Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

[Resolved] insert php nav links location

Home Forums Support insert php nav links location

  • This topic has 7 replies, 2 voices, and was last updated 5 years ago by Tom.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #153208
    theonetruevlad

    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();
    #153239
    Tom
    Lead Developer
    Lead Developer

    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.

    #153263
    theonetruevlad

    Sadly does not support pagination and does not show the whole post, only shows title with option for an excerpt.

    #153342
    Tom
    Lead Developer
    Lead Developer

    Can you post the code you’re using to a pastebin? http://pastebin.com/

    #156493
    theonetruevlad

    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:

    Insert PHP Code Snippet

    Insert 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.

    #156624
    Tom
    Lead Developer
    Lead Developer

    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?

    #156852
    theonetruevlad

    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.

    #157201
    Tom
    Lead Developer
    Lead Developer

    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.

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.