Theme Variables

Like common theme, HTMLy have many variable.

Note: you should compare it with the latest theme included with the package.

layout.html.php

This file contain the main layout for your theme.

<!DOCTYPE html>
<html>
<head>
    <?php echo head_contents(); ?>
    <title><?php echo $title; ?></title>
    <meta name="description" content="<?php echo $description; ?>"/>
    <link rel="canonical" href="<?php echo $canonical; ?>" />
    <?php if (publisher()): ?><link href="<?php echo publisher(); ?>" rel="publisher" /><?php endif; ?>
    <link rel="stylesheet" type="text/css" href="<?php echo site_url();?>themes/theme-name/css/style.css">
</head>
<body>
<?php if (facebook()) { echo facebook(); } ?>
<?php if (login()) { toolbar(); } ?>
    <div class="header">
        <?php if(is_index()) {?>
            <h1 class="blog-title"><a href="<?php echo site_url();?>"><?php echo blog_title();?></a></h1>
        <?php } else { ?>
            <h2 class="blog-title"><a href="<?php echo site_url();?>"><?php echo blog_title();?></a></h2>
        <?php } ?>
    <div>
    <div class="wrapper">
        <div class="main-content">
            <?php echo content(); ?>
        </div>
        <div class="sidebar">
            <div class="search">
                <?php echo search(); ?>
            </div
        </div>
    </div>
    <div class="footer">
        <?php echo copyright() ?>
    </div>
<?php if (analytics()): ?><?php echo analytics() ?><?php endif; ?>
</body>
</html>

layout.html.php variable

Some of the variable below usually used on layout.html.php but can be used on any template file.

Print out meta charset, viewport, sitemap, and RSS etc.

head_contents()

Print out the page title, meta description and canonical link.

$title
$description
$canonical

Google Plus publisher link

publisher()

The site/blog url

site_url()

The facebook script if we use Facebook comment

facebook()

Login or not?

login()

The toolbar

toolbar()

Is this index page?

is_index()

Blog title, tagline, description

blog_title()
blog_tagline()
blog_description()

The main content

// This displayed the content from other 
// template file like main.html.php, post.html.php 

content()

Copyright notice and credit link

copyright()

Google anaytics

analytics()

main.html.php

This template file handle posts index like on dynamic frontpage, tags, categories, archive and search result.

main.html.php variable

Below is the most important variable for main.html.php since it contains post collections.

$posts

We need to do foreach to extract it.

<?php foreach ($posts as $p): ?>

<?php endforeach;?>

Available variable inside the foreach

$p->url
$p->title
$p->date
$p->body
$p->description
$p->tag
$p->category
$p->author
$p->authorUrl
$p->related
$p->views
$p->type
$p->file
$p->image
$p->video
$p->audio
$p->quote
$p->link

Print out the teaser inside foreach

get_teaser($p->body, $p->url)

The category info

$category->title
$category->body

Tags title, archive title, search title (helper)

$tag->title
$archive->title
$search->title

Breadcrumb

$breadcrumb

The pagination

$pagination['prev']
$pagination['next']
$page
$pagination['pagenum']

To render complete pagination

$pagination['html']

Disqus comment count

disqus_count()

post.html.php

This is for single post and the available variable is like on main.html.php:

$p->url
$p->title
$p->date
$p->body
$p->description
$p->tag
$p->category
$p->author
$p->authorUrl
$p->related
$p->views
$p->type
$p->file
$p->image
$p->video
$p->audio
$p->quote
$p->link

Breadcrumb

$breadcrumb

Disqus comment

disqus($p->title, $p->url)

Disqus comment count

disqus_count()

Post navigation

$prev
$next

The $post and $next variable also has all variable like on $p. Eg.

$prev['url']
$prev['image']

Related posts

get_related($p->related)

static.html.php

Below is the common variable for static.html.php

$p->title
$p->url
$p->body

profile.html.php

The profile page variable.

The $posts variable is like on main.html.php

$name
$about
$posts

Other template file

Mostly only contains HTML tags. Or print the search widget:

search()