Okay
  Public Ticket #1639998
Is it possible to show specific rows?
Closed

Comments

  • Justin Hollender started the conversation

    I'm looking for a way to display some pricing tables on my site. I want to create a master price table, and then on different pages of the site display specific rows of the table. For example:

    • Master price table contains
      • Home Model 1, Price 1, Price 2, Price 3
      • Home Model 2, Price 1, Price 2, Price 3
      • Home Model 3, Price 1, Price 2, Price 3
    • Home Model 1 page shows only the row related to prices for that model, and so on.

    Is this possible with wpDataTables?

  • [deleted] replied

    Hi Justin Hollender,
    Thank you for the inquiry.

    Something like that is possible if you create one Manual table where you will add all the data that you need, and in one column you add the ID's of the page (this column will not be visible on the front-end).

    Then you have to create the second table from MySQL query that will fetch the data from the first table and add condition to display just the data related to this page. e.g.

    SELECT * FROM wp_wpdatatable_1 WHERE id_column_name = %CURRENT_POST_ID%

    %CURRENT_POST_ID%  will be replaced with the ID of a currently active WordPress page or post. You can take a look at this feature at this page - Making dynamic SQL Queries with placeholders.

    You can try our sandbox site: Front-end & Back-end - you can find a fully functional version there to try out all plugin features.

  • Justin Hollender replied

    Hey Milos,

    Thanks for the information. I'm trying to test this out in the sandbox admin area, but I can't figure out the second table setup. The first table is:

    ModelTacomaKingSalem
    Anna Belle110,000120,000125,000
    Sequoia310,900345,000320,900
    Ashton Park234,900250,900240,900

    Then I started setting up a page for the Anna Belle, which should only have the pricing from row 1 visible. Would I need to add another column to the table for the WordPress Post ID?

    Thanks,

    Justin

  • Justin Hollender replied

    Milos,

    Actually, I figured it out. But the site refreshed and deleted my table from the sandbox while I was working on it.

  • [deleted] replied

    Hi Justin Hollender,

    Yes sandbox refreshes every 15th minute of every hour. If you have any more questions don't hesitate to ask.