GetSimple Support Forum

Full Version: Basic theme template?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Cant find a need a bare bones theme template. Something with just the bare essentials. Anyone wanna help?
There are two default templates in GS.
If you are familiar with building website templates, or at least html pages, just go through GS wiki, and you should easily build a GS template from scratch on your own.
There are 4 base tags you actually need:
1. show page title
2. embed page's header
3. show menu
4. show page content
easy as it sounds Smile
@yojoe
I would add:
5. get_footer (for plugins that embed scripts)

@conholster
I suggest you take a look at template.php's source code in some basic themes like Cardinal or the nice old Getsimple default theme.

Anyway here's a quick example.
We have a very basic html sample page:
Code:
<!DOCTYPE html>
<html>
<head>
    <title>Page title - Site name</title>
</head>
<body>
    <strong>Site name</strong> - <a href="http://mysite/">home</a>
    <hr>
    <h1>Page title</h1>
    <p>
        Here goes the page content.
    </p>
    <p>
        More content...
    </p>
    <hr>
    menu:
    <ul>
        <!-- li elements with menu links -->
    </ul>
</body>
</html>
Insert some basic template tags instead of the sample content:
Code:
<?php if(!defined('IN_GS')){ die('you cannot load this page directly.'); } ?>
<!DOCTYPE html>
<html>
<head>
    <title><?php get_page_clean_title(); ?> - <?php get_site_name(); ?></title>
    <?php get_header(); ?>
</head>
<body>
    <strong><?php get_site_name(); ?></strong> - <a href="<?php get_site_url(); ?>">home</a>
    <hr>
    <h1><?php get_page_title(); ?></h1>
    <?php get_page_content(); ?>
    <hr>
    menu:
    <ul>
        <?php get_navigation(return_page_slug()); ?>
    </ul>
    <?php get_footer(); ?>
</body>
</html>
Save this as template.php in its own folder (inside themes), and you're done.

Edit: Make sure you're saving it as UTF-8 without BOM.