Advanced Theming

HTMLy almost can list any posts based tag, category, author, or type. You just need to read the /system/functions.php to know any get helper.

HTMLy also automatically include the functions.php if this file exist in theme folder. When naming the function in theme functions.php, use themeName_functionName(), to make sure not conflicted with existing function

Get Specific Posts by Tag

We can display list of posts by tag by using built in function:

// $tag = the tag slug
// $page = the page
// $perpage = how many posts
// $random = true or false

get_tag($tag, $page, $perpage)

Let say we already have Featured tag and we want displayed it as posts list.

// get the posts with featured tag
// as 1 page, 4 posts, random false

<?php $featured = get_tag('featured', 1, 4);?>

<?php foreach($featured as $f):?>

// the div etc. goes here.

<div class="content">
    <div class="title"><?php echo $f->title; ?></div>

<?php endforeach;?>

Get Specific Posts by Category

We can display list of posts by category:

// $category = the category slug
// $page = the page
// $perpage = how many posts

get_category($category, $page, $perpage)

Let say we want to display HTMLy category.

// get the posts categorized as htmly
// as 1 page, 4 posts

<?php $htmly= get_category('htmly', 1, 4);?>

<?php foreach($htmly as $h):?>

// the div etc. goes here.

<div class="content">
    <div class="title"><?php echo $h->title; ?></div>

<?php endforeach;?>

Other Get Helper

By Specific Keyword (Search)

get_keyword($keyword, $page, $perpage)

By Specific Type (image, video etc.)

get_type($type, $page, $perpage)

By Author

// $name = username

get_profile_posts($name, $page, $perpage)

Get Image From Post

If the content type is image by printing:

 <?php echo $p->image; ?>

will outputting the featured image. We can get an image from regular post or even video thumbnail by calling this function:


If in post than it become:


Get Specific Static page


Example get "about" page. Always use the slug.

$static = find_page('about');

Later we can display it:

<?php echo $static['current']->title;?>

For availabe tag see theme variable for static.html.php

Get specific static sub page

<?php $mySub = find_subpage('parent-page-slug', 'sub-page-slug'); ?>
<?php echo $mySub['current']->body;?>

Displaying sub pages in parent page

Perhaps you want to displaying the subpage link or even the content in parent page.

<?php if (isset($is_page)):?>

<?php $subPages = find_subpage($p->slug); ?>
<div class="container">
  <div class="row">
    <?php foreach ($subPages as $sp):?>
        <div class="col-lg-6" style="margin-bottom:2em;">
            <div class="card">
            <h3 class="card-header"><a href="<?php echo $sp->url;?>" style="color:#1a1a1a;"><?php echo $sp->title;?></a></h3>
                <a href="<?php echo $sp->url;?>"><img height="200px" style="object-fit: cover;" class="card-img-top" src="<?php echo get_image($sp->body);?>" alt="<?php echo $sp->title;?>"></a>
                <div class="card-body">
                    <a href="<?php echo $sp->url;?>" class="btn btn-outline-info">Info</a> <a href="<?php echo $sp->url;?>#download" class="btn btn-outline-primary">Download</a> <?php if (login()) { echo '<span><a class="btn btn-info" href="'. $sp->url .'/edit?destination=post">Edit</a></span>'; } ?>
    <?php endforeach;?>

<?php endif;?>

Demo: HTMLy theme page.

Note: the available variable is like on regular static or sub page.