• Hi!

    I need some help to complete my recent task:
    I would like to highlight all of the newly added or edited texts or links or table rows inside all posts on my page, so the visitors can see what is new since their last login.
    Highlighting new posts wouldnt be fine, coz I realy dont add posts, but edit them.

    THX

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Have you thought about including a small section at the end of the post with dated titles that explain when and where things were changed rather than inline-highlighting (which could get messy)? Such as:

    Update: 01/01/2017
    Changed the title of the post to better represent the content

    Update: 02/01/2017
    Fixed some punctuation errors

    etc..

    I haven’t seen any plugins that do it but I’m sure there’s a way to notify the user of any updates to a post using their login date and the last edit date to display a message saying ‘This post has been updated, check the bottom of the post for the list of recent changes’

    ~ Steven

    Thread Starter mucsiattila

    (@mucsiattila)

    Hi!

    I just want something like a highlight or marker, like gmail has when you open your mailbox, and it highlights the new messages at the front of the list, or like some torrent sites that put “NEW” sign next to the new torrent names.
    Inline marking is necessary coz users wont read all the page. They just want a quick view, and see if something is new or updated.

    Moderator bcworkz

    (@bcworkz)

    While themes and even WP_Query only use the post_date field to facilitate date related functionality, every post does have a post_modified field that’s part of the WP_Post object. You only need to modify the appropriate template to output the extra HTML needed when post_modified is less than some amount of time from the present. The amount of time something would be considered “new”.

    For example, you could just add another class to the post’s main container that would change its background color. And/or add a “New!” graphical element before or after the title. If you can find a graphic that works from an icon font like dashicons, this could easily be added using only the CSS :before pseudo-selector after the selector for the fore mentioned added class.

    The specifics would depend on your theme, but a generic example within class output:
    if ( 2 * DAY_IN_SECONDS > time() - $post->post_modified ) echo 'post-new';
    Then in CSS: .post-new { background-color: LightBlue; }

    Thread Starter mucsiattila

    (@mucsiattila)

    I think I wasnt so clear.
    I dont want to highlight the entire post, only a line or link or table row inside the post, or on a page, like this:
    example table

    Moderator bcworkz

    (@bcworkz)

    There’s no existing mechanism for tracking when individual elements are edited. You would need to manually add an extra class to the table row element that causes the highlight to appear, then go back and remove it after a period of time.

    To automate the process would require completely changing how the table is generated. The specifics would depend on the nature of the underlying data, but for example, your document table could be created through a shortcode. The shortcode handler could create the table based on documents that are in a particular folder. Any documents that are recently modified would have an extra class added to its associated row that causes the background color to be different.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Highlighting latest modifications inside the post’ is closed to new replies.