0

I am designing a Wordpress blog where I will have two types of posts:

a. Normal posts; regular posts with a number of text paragraphs
b. Posts with table content, where the table structure will be more or less like http://click.apache.org/docs/user-guide/html/images/introduction/simple-table.png

Knowing that normal posts will be the regular Posts > Add New from the admin area. I came up with two solutions for the table-type posts:

Solution A

A custom post type. My knowledge of custom post types is very limited but I believe I would need to create the custom post type, a template for it as well as any custom fields I may need

Solution B

Shortcodes, where I treat posts with table content just like regular posts only that where I want to place the table I will use a string such as:

[PEOPLETABLE]231|Albert Master|albert.master@gmail.com|Bonds
210|Alfred Alan|aalan@gmail.com|Stocks
256|Alison Smart|asmart@biztalk.com|Residential Property[/PEOPLETABLE]

The html in the post will then be rendered by passing this string to a shortcode where the parsing will take place and the HTML generated.

Am I right in saying that Solution B is faster as it does not involve custom templates and custom fields?

  • Hi, i think "Solution B" is the only choice. As even you register a new post type, you will have to use the shortcode to create the table !! Unless you want to use HTML. – Shazzad Jul 7 '14 at 16:00
  • Your main issue here is not performance, it's usability. Whatever you build you'll have to subject it to the client – Tom J Nowell Jul 7 '14 at 16:01
0

If the posts with tables are part of "normal" blogging flow and appear with rest of the posts, there is probably little reason to separate them out into CPT. Shortcode bit is irrelevant, you'll have to deal with tables regardless of native or custom post type.

The use cases for CPTs loosely start for content that no longer belongs in stream of blog posts (or arbitrary purpose pages).

  • Yes Rarst, there will be absolutely no difference in how the two post types will be treated on the front end, they will all appear on the home page, on the archive pages, on the category pages, in section such as most commented posts, etc. In fact - also pointed out by Shazzad - I didn't know that a CPT would still require a shortcode to render the table, I thought the template would have taken care of that. – WPRookie82 Jul 7 '14 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.