WordPress.org

Ready to get started?Download WordPress

Forums

next_posts_link not working when inserted in a static page (20 posts)

  1. ganzua
    Member
    Posted 7 years ago #

    Hi!

    I put the loop in a static page because I want to show there my last 10 posts.

    I'd like to include the navigation links so you can keep on reading the next 10 posts;

    '<div class="alignleft"><?php next_posts_link('« next posts') ?></div>
    <div class="alignright"><?php previous_posts_link('previous posts »') ?></div>'

    The problem is next_posts_link and previous_posts_link do not work. I guess they don't because the link that they display is like;

    'wordpress/?page_id=15&paged=2'

    and I guess page_id=15&paged=2 doesn't exit.

    How can I solve this issue?

  2. moshu
    Member
    Posted 7 years ago #

    If by "static page" you meant a Page - it is not supposed to work.
    Don't mix posts and Pages - they are meant for different things!

  3. ganzua
    Member
    Posted 7 years ago #

    "If by "static page" you meant a Page - it is not supposed to work.
    Don't mix posts and Pages - they are meant for different things!"

    -> I need to do that because I converted index.php in a frontpage that is displaying what's new in the whole web and an excerpt of the last post.

    I want to display my last 10 posts elsewhere like if it was a common blog. Any idea moshu? :)

  4. ganzua
    Member
    Posted 7 years ago #

    Is there anyway to link to next posts form a static page?

  5. moshu
    Member
    Posted 7 years ago #

    No. Once you are told the template tag does NOT work in the setting you put it in (i.e. on Pages) - stop bumbing.

  6. ganzua
    Member
    Posted 7 years ago #

    Why bumbing? I'm just asking for a ->workaround<- in case somebody found any, a plugin or whatever. I DID recieve the message that next_posts_link doesn't work in static pages. Take it easy.

    I'm pinned; if I make a home.php displaying what's new in the web, index.php stop working and I lose my 10 entries blog.

    If I put the last 10 entries in a static page I lose the navigation.

    ... and if I ask for workaround I'm bumbing?

  7. Dysantic
    Member
    Posted 6 years ago #

    Moshu,

    Your reply was not helpful at all, especially when what Ganzua asked is actually possible. A little bit of searching through the WordPress Support forums, and even the web, would have yielded some results that you could have provided him to give a bit of assistance. Telling him to "stop bumbling" is fairly unprofessional.

    Ganzua,

    I was asking the same question a few days ago, and was somewhat frustrated that this isn't an actual feature within WordPress. A static page with dynamic content seems to be a great idea to me, and suits the needs of my site perfectly. Here is what I found:

    http://www.transycan.net/blogtest/2007/09/10/static-frontpage-combined-with-dynamic-content/

    The above link will explain, and provide code, for a specific page template you can use to have page content mixed with category listings, or in my case, page content mixed with category posts.

    However, I ran into an issue where the post content would exceed the amount I had set for each page, and the following page would display the same content as the previous page. It would appear that a fellow moderator of Moshu's going by the name of Kafkaesqui, was asked this question a year ago, and he provided this answer:

    http://wordpress.org/support/topic/57912#post-312858

    I hope this helps.

  8. ganzua
    Member
    Posted 6 years ago #

    Hi Dysantic! It is very kind of you, thanks a lot!

  9. Chris_K
    Member
    Posted 6 years ago #

    :-)

    Hi Dysantic.

    This thread was 4 months old. Ironically, the transycan site you cited is moshu's. The same fellow you chastised.

    As you might suspect, capabilities and knowledge can change over time.

  10. ganzua
    Member
    Posted 6 years ago #

    "This thread was 4 months old"

    ...and it is great that someone took the time to answer and that he even sent an email to me.

    The workaround to my question is explained by kafkaesqui, in a thread that I didn't manage to find when I did my research before I asked, not in moshu's page.

    "The same fellow you chastised."

    The same fellow that accused me of bumbing and eased my willing to ask again anything in here if it wasn't because users like Dysantic.

    I really don't understand your reply.

  11. Chris_K
    Member
    Posted 6 years ago #

    I really don't understand your reply.

    And it wasn't addressed to you :-)
    But you're welcome to reread it.

    It was more to point out irony than anything else. I'll try again if it helps.

    4 months is a long time in the software world. Software evolves, people learn new things.

    The first link that Dysantic gave you was written by Moshu, almost 4 months after this topic was created.

    Does that help clarify? Key words I'm going for here are irony and evolution. That's all. No chips on shoulders. No flames.

  12. Dysantic
    Member
    Posted 6 years ago #

    HandySolo,

    Yes, actually, that is ironic that one of the sites that I mentioned is actually maintained by Moshu. I'd say "small internet", but that doesn't have the same effect as saying "small world". :-)

    However, I was fairly disappointed by Moshu's earlier response, regardless if he/she eventually created a work-around that I personally find useful (BTW, thanks Moshu).

    The issue that Ganzua was experiencing could have been resolved four months ago by providing Kafkaesqui's answer (which is a year old), instead of the response he/she provided. Understandably, I'm sure the WordPress forums are a huge database of information, but it never hurts to even suggest to look further instead of a snotty "No. Once you are told the template tag does NOT work in the setting you put it in (i.e. on Pages) - stop bumbing.".

    In the end, this resulted in Ganzua losing some faith in the WordPress forums. While Ganzua is only one person, another major factor is word-of-mouth, which WordPress relies on for it's status as the best blogging tool available (which I still believe). But, as you can see from my original reply, a moderator's response didn't sit well with me and also prompted me to try harder to find an answer for Ganzua (and at the same time, fix an issue I was experiencing too as I didn't accept that this was impossible).

    While I am thankful for the time that the WordPress moderators offer to assist those in need, at the same time, responses like the one Moshu originally provided don't properly represent the standard response one can expect from a question posted in the WordPress Forums, and that should be known, and perhaps, addressed.

    Just my two cents, without a grudge, and a huge thank you to those who are responsible for WordPress and it's continued excellence.

  13. Chris_K
    Member
    Posted 6 years ago #

    4 months is a long time in the software world. Software evolves, people learn new things.

    Here's the beauty of it all: If you don't care for how things are going here, you can roll up your sleeves and join in! Thankfully, anyone can participate and answer questions (you have no idea how thankful we are for that too :-).

    Nobody is paid and we're all volunteers. We (inclusive) all control the way support works here. Join in!

  14. Dysantic
    Member
    Posted 6 years ago #

    lol - Perhaps I might, HandySolo. Thanks for being a good sport. :-)

    Ganzua, did Kafkaesqui's answer resolve the issue you were experiencing?

  15. ganzua
    Member
    Posted 6 years ago #

    Handsolo

    "And it wasn't addressed to you :-)"

    well, sorry

    "But you're welcome to reread it."

    and you are all the way welcome too, obviously english is not my mother tongue and I'm probably misunderstandig anything. As far as I understand I asked how to link to previous entries using next_posts_link from a static page and in moshu's web page there is an explanation of how to set a static page as front page which it's not the point if I'm not wrong.

    "It was more to point out irony than anything else. I'll try again if it helps."

    no acridity here, no flames, just a next_posts_link question. I catched your irony and I'm not disturbed, I simply thought it was not well addressed. And this one is not a bad tempered man, all the contrary. Sometimes I wish I could exchange some points of view with Matt about wp and this forum since we both are musicians and perhaps we understand each other better ;-)

    "Key words I'm going for here are irony and evolution"

    key words in this side of the sea are that I din't want to bumb or annoy to anybody, just to find a way/workaround to make next_posts_link work in a static page, that's all. I really didn't find fair that Dysantic is chastising and this one is bumbing.

  16. ganzua
    Member
    Posted 6 years ago #

    Dysantic

    Thanks again for your replay and for your email, I have to test further because my custom theme is quite modified now. I'll report if I manage to make it work and how ;-)

    ...and by the way, if you have any question that you think I resolved in my web feel free to ask me by mail or whatever, ok?

  17. ganzua
    Member
    Posted 6 years ago #

    ...and by the way again, anyone can contact me, I'll reply if I know the answer

  18. moshu
    Member
    Posted 6 years ago #

    :)
    As the only non-native English speaker moderator (re: ganzua) I find it funny to read this revived thread while travelling in my native land in Europe... and having only random access to internet by "stolen" wireless connections.

    I have the highest respect for Kaf who is/was one of the most knowledgeable coders around WP - however, I am not sure his code in the linked topic is applicable for Pages
    example.com/page/2 is not a (static) Page (attn: Dysantic). It is just a "paged" version of the index.php. And by default Pages in WP can not have next_post_link. My initial reply was referring to this fact. WP is very flexible but sometimes you have to deal with its limitations, sorry.

    I'd glad if any of you can provide a solution to the original question, so that I could refer to it in the future. I might even blog about it :)

    I still believe this template tag does NOT work on Pages.

    See you soon when I'll be back at my computer.

  19. ganzua
    Member
    Posted 6 years ago #

    "As the only non-native English speaker moderator (re: ganzua) I find it funny to read this revived thread while travelling in my native land in Europe"

    Well, provided it is not an irony I have too say that in my very own web I wrote a blog on your native land folk and history, which is well known because of movies on that particular topic and "revivals" ;-).

  20. ganzua
    Member
    Posted 6 years ago #

    Well I tried kafkaesqui solution and it is working in my custom theme now.

    My query was;

    <?php query_posts('posts_per_page=5'); ?>

    and I replaced with;

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("posts_per_page=5&paged=$paged");
    ?>

    ...but this is tricky because you are making wordpress to ask for pages, as Kafkaesqui stated.

    I think query_posts function should be updated in the core so pagination works properly when using a static page as home page.

    many thanks to Dysantic and Kafkaesqui! ;-)

Topic Closed

This topic has been closed to new replies.

About this Topic