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
Read available widget for advanced theming.
Get Specific Static page
find_page($static)
Example get "about" page. Always use the slug.
$static = find_page('about');
Later we can display it:
<div>
<?php echo $static['current']->title;?>
</div>
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>'; } ?>
</div>
</div>
</div>
<?php endforeach;?>
</div>
</div>
<?php endif;?>
Demo: HTMLy theme page.
Note: the available variable is like on regular static or sub page.