Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic theme template?
#3
@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.
Reply


Messages In This Thread
Basic theme template? - by conholster - 2012-03-18, 03:51:22
Basic theme template? - by yojoe - 2012-03-18, 06:01:50
Basic theme template? - by Carlos - 2012-03-18, 17:43:52



Users browsing this thread: 1 Guest(s)