Okay
  Public Ticket #2454156
Show recent table entry
Closed

Comments

  • Brandon Bowman started the conversation

    Our client has a table that they add entries monthly. Is there a way to display the most recent entry on another page? Through either a feed from the table or a query?

  •  2,507
    Aleksandar replied

    Hello Brandon

    Thank you for your purchase.

    You would need to add a timestamp column to the table.

    For example, I created a simple manual table:

    9084543304.png

    wdt_ID column is being automatically generated, and is usually hidden, but I've displayed it here for explanation purposes.

    When I created a table, and added the first row, I could then modify it. So, in order to set the Datetime column to be auto-populated, I had to open the table in the database. It is being stored as wp_wpdatatable_6, and you can see its database name in Editing tab in the settings above the table:

    8975736742.png

    Then, in PHPMyAdmin, I opened the table, and ran the following query:

    ALTER TABLE `wp_wpdatatable_6` CHANGE COLUMN `datetime` `datetime` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP;
    
    7657773118.png

    After that, again in the Editing tab, above the table, I changed the "ID column for editing" from "wdt_ID" to "datetime" (as you can see in the screenshot above). Then I disabled editing for "wdt_ID" in the column settings:

    4393899573.png

    datetime column, being the "ID column for editing" automatically cannot be edited, but is automatically filled.

    You can also choose to hide it from view if you'd like.

    Then, you can sort that table per timestamp column, and it should work.


    I hope this helps.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables