• mcwinston

    (@mcwinston)


    Hey guys,

    here is my current state:
    I have a homepage where all posts of specific categories were shown in a seperated list.
    e.g. all posts of category A are shown in first list – ascending to their Post-ID.
    With the REST-API I will now change the content of these posts – especially the title.
    After that update the posts also have to be updated without any reload of the page.

    I found the following tutoriaa, which couldn’t help me enough:
    https://premium.wpmudev.org/blog/load-posts-ajax/

    So, the ID’s of the post will be mostly the same, but the title will change periodicly and this should be updated in frontend dynamicly.

    How can I do this?
    I would be glad if you can help me.

    • This topic was modified 6 years ago by mcwinston.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Joy

    (@joyously)

    REST != AJAX

    Why would you want to have a page of posts, change them all, but don’t reload the page? Why bother with “updated without any reload of the page”? The page content changed, so why not just reload the page?

    Thread Starter mcwinston

    (@mcwinston)

    Because in my case I need this feature ??
    Maybe I explain it again:

    I have a list of posts, where only the title is shown.
    The list is ordered by post id
    with the rest api I will swap the titles:
    e.g.
    (1) gets title of (2)
    (2) gets title of (3)
    (3) gets title of (1)

    this swap will occure every 10 seconds.
    In this case post (1) is currently “active” and the other posts are in the queue.

    A page reload will be very inappropriate for the user.

    Or maybe there are other ways to implement this feature.
    But I will need the REST API for this task, because a Raspberry Pi controlls this “queue”.

    • This reply was modified 6 years ago by mcwinston.
    Moderator bcworkz

    (@bcworkz)

    OK, so you are rotating titles. But why would you save these changes? Eventually each post will have the same title again. This would put a huge load on your DB server for no real reason. Why not alter the order of the actual posts on the page without actually changing each post? Maybe you can even alter the order within a CSS flexbox, so the HTML does not even need to change.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Reload Posts after updating a Post with REST-API’ is closed to new replies.