0

To start with, I apologise if this is a double, which I believe is the case, but searching for similar posts is not easy.

In my blog, I will have a lot of posts(more than 1000 at one stage) where the only change between these posts is data.

The content - made up of heavy HTML - will be the same.

A good example - although my HTML will be bigger - is:

a busy cat

... where the only difference between posts are the values.

Now I know I can save the same HTML for every post I publish, but is there a more efficient way of doing it in order NOT to save the same HTML over and over again in the wp_posts table?

It would be such a big waste in my opinion.

What I thought so far is that I can:

a. Keep the empty HTML in - let's say - a text file with dummy data

b. In the post I save only the data, so if we are to use the above image as an example, I save 1.9|0.003|40%
and
1.7|0.002|43%

c. In the single.php file, on the fly that is, I get the HTML from the text file, the data from the post and I merge them by manipulating the pipe-delimited string

Does it make sense and if yes, is my way of doing it the best way? Or maybe I should keep the HTML in the database, in a custom table maybe?

Thanks!

4
  • Did you consider using your own table shortcode with data input but renders the html tables with the data?
    – birgire
    Jun 30, 2014 at 12:10
  • 1
    Brilliant - just what I needed birgire, was not aware of shortcodes. Thanks!
    – WPRookie82
    Jun 30, 2014 at 12:13
  • I've one example of a table shortcode on github, that's hopefully helpful.
    – birgire
    Jun 30, 2014 at 12:21
  • 1
    Perhaps someone should write that out as an answer so it can be accepted, in more detail
    – Tom J Nowell
    Jun 30, 2014 at 12:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.