CPT vs Custom page template vs …

How many ways are there that you can create a custom page? I am asking this because I want to dedicate some part of my website to some adventures that I’ve had with code either CSS or jQuery or Vanilla/WP PHP.

The solutions that I have already come up with are:

  1. Custom Post Type
  2. Custom Page Template
  3. WP Hierarchy – creating separate php files
  4. Default post and page 
  5. … – I’ll fill this in the future:) –

Except option 3 all the others need some way to override default WP behavior to enable myself to enter PHP script inside the post. To overcome this obstacle several solutions have been suggested:

  1. Use of a plugin such as https://wordpress.org/plugins/insert-php/
  2. Through a shortcode

I have two problems using plugins. Firstly I tend to write my own code and usually am wary of plugins. Secondly I doubt that some requests to the database would work inside the plugins. Shortcodes are not much of great solution too and my reason for that is that it needs to be stored inside files rather than the database.

I’m gonna try the plugin first to see what happens.

Update: I downloaded and installed PHP Everywhere. So far it seems fine. I have tested get_title() and the tile of the current post was returned. Now I would like to know where in the database it keeps the data. Is it considered as a meta data or taxonomy?

Update: The data for PHP Everywhere is collected inside WP_postmeta which is what I hoped. This means that every snippet is in relation with one post so the data is stored neatly and cleanly. 

Note to myself:

Post types, post page, attachdment …
taxonomy – category, tag, link category, post formats classification and organization 
‘custom-fields’ (aka meta-data) – can be added to taxonomyies) – data about data, post_content, post_title, post_author, post_name(=slug)
page template: full-width, sidebar left

CPT vs Custom page template vs …

Leave a Reply

Your email address will not be published. Required fields are marked *