Outputting a Responsive, programatically created table.

[ad_1]

Hello! A couple months ago I started my WordPress journey, I needed to build a page in which I needed to query a database and output to page. I ended up setting up a REST endpoint that returns a JSON that I look through to build an HTML table.

Now, the formatted table, for some reason I don’t completely understand, doesn’t take on any of my CSS, so I cannot make it responsive on mobile.

Before I try to fix that, is there a recommended way of programatically building a table and showing it that I don’t know of? Preferably without using an external plugin, or a plugin I don’t need to pay for even if it needs a little bit of tinkering.

[ad_2]
3 Comments
  1. Tables don’t generally work well on mobile, simply due to width… tables are wide, and don’t collapse – that’s really all there is to it.

  2. I built a dynamic horizontally scrolling comparison table that uses custom post type data to populate. You need knowledge of PHP, HTML, CSS, JS (if you want to add sorting) and WP functions to make it happen.

    There are plenty of responsive table tutorials out there if you want a truly responsive table.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer