• Hello,

    I am trying to incorporate some additional information on a dynamic page.

    Basically, I would like to be able to include a tablepress table outside of the normal posting area.

    I have a basic understanding of php, css and html.

    Is it possible to add a second posting area so that when I go to add a new post I would see this second section in the dashboard/new post? Then it would simply be a matter of location within the php template.

    Thank you in advance to anyone that takes a moment to read and respond.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi,

    you may use a plugin to create custom fields for posts and store the extra information in the custom fields. My favourite one is pods as it is easy, flexible and powerful without much coding . Custom fields can be displayed using pods template which can be configured in admin backend .

    I hope it helps.

    Hi,

    thanks for your post, and sorry for the trouble.

    Yes, something like what VisualData described might work. Another idea could be to directly add the table inside the theme files, by using the available Template Tag functions that are documented at https://tablepress.org/faq/documentation-template-tag-functions/

    Regards,
    Tobias

    Thread Starter L4SN

    (@l4sn)

    Tobias,

    Would that make it so that I can add different tables?

    As an example –

    I have several pages with different items that run off of the same template.

    I would like to include a table with specific information for each one of these items.

    Item A – Table A
    Item B – Table B
    Item C – Table C
    and so on…

    If that is what is described in the link you provided I apologize for asking again but I am having some problems understanding the information.

    And thank you very much for taking the time to read and help me with this. It is greatly appreciated. ??

    Hi,

    hhm, that could be tricky… In that case, you might indeed have to restructure the theme, so that you can e.g. add content from a custom field in a different place than the actual page content.

    Regards,
    Tobias

    Thanks Tobias. the template tag function is a good idea.

    HI L4SN,

    How many items will share the same template? if you have a few items (for example pages) sharing this template and you don’t need custom fields somewhere else, Tobias’s solution actually works better, without the overhead of another plugin for custom fields. You may first retrieve the slug of the page, and produce a table specific to this page using a “if” statement or “switch” statement.

    If you have many items or you want to add new items (for example posts) frequently in the future sharing the same template, then storing TablePress short codes in custom fields may be a better alternative.

    Hi,

    yes, that’s a good suggestion, VisualData!

    For just a few items/tables, a hardcoded switch with the Template Tag functions should be the easiest. Custom Fields should give you more flexbility if you want this for many items/tables or if you want this to be configurable by the user/editor who works on the pages.

    In both cases however, you will have to do a little bit of PHP programming.

    Regards,
    Tobias

    Thread Starter L4SN

    (@l4sn)

    VisualData,

    There will be roughly 300 different items that will need corresponding tables. The template I have will work specifically with these items and no other section of my site.

    I think I understand what both you and Tobias are suggesting but I am having a difficult time with the implementation of this.

    Is there a basic way to achieve this and if so, how do I begin?

    And again, thank you both very much for helping me with this.

    Hi,

    I don’t have code available for this, but you’ll have to get into theme development, I guess, with learning about Custom Fields (https://codex.www.ads-software.com/Custom_Fields ) and the relevant PHP functions.

    Regards,
    Tobias

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Database Relations and Tables in PHP’ is closed to new replies.