Question

a template designed and hard coded so that we can easily replicate and make property changes ourselves in future. Here: What is meaning of Hard coded for wordpress?

Was it helpful?

Solution

Wordpress is, among other things, a CMS (content management system). When you view a website which is using Wordpress as its backend, Wordpress will show you a page with data from the database (which you have entered in the Wordpress dashboard) and it will format it based on which ever theme to you have selected.

A theme is a collection of files (.php, .css, .js, .html, .jpg etc) which work together to format and style the pages.

A (very basic stripped out) example would be this is a template file;

page-home.php

<?php get_header(); ?>

<div class='page'>
    <h2><?php the_title(); ?></h2>
    <div><?php the_content(); ?></div>
</div>

<?php get_footer(); ?>

Now say you go into the backend and edit the "home" page and you make the title "My First Page" and then you add in some content into the WYSIWYG, "Checkout my first page!". When you view the page using Wordpress it will show you;

<html><body>

<div class='page'>
    <h2>My First Page</h2>
    <div>Checkout my first page!</div>
</div>

</body></html>

Now thats all fine any dandy. But what happens if you wanted a sidebar on this page? What happens if you wanted to re-arrange the title and the content so the title is below the content? Can you do this in Wordpress directly? No. This is whats called "hard coded". It is something that you cannot change from the Wordpress backend, and instead must change it in the template files by writing/changing code.

The idea of a site setup using a CMS is that any area that you want to be able to update using the CMS, you should be able to. Wordpress does this by using the above (ie the title and content areas) as well as things like feature images, categories, menus, theme settings, plugins (and their settings).

Themes (and plugins) can also take advantage of things like meta data. Meta data is data associated with an object (usually a post/page/user etc) which they can use for logic or displaying certain things to the front end user. Some themes have areas where you can enter this meta data and it will show up in the front end. A good example of this is Advanced Custom Fields.

The trick with making a great website (using a CMS) is a balance between;

  • The user being able to edit all aspects of the site that they wish. As well as extending the sites functionality with plugins.
  • Not giving the user too much freedom such that they have to write code or can screw up the design/layout/functionality of the site.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top