Available Widget

Here are widget that available for your theme.

search()
menu()
recent_posts()
popular_posts()
archive_list()
tag_cloud()
category_list()
get_related($p->related)
recent_type($type)

Search Form

Below is the function.

// $text = button value

search($text = null)

Menu

This will generating the menu.

// $custom = custom class

menu($custom = null)

Recent Posts

If you print the recent post widget it will only generate list of post by title.

// $custom = true or false. Default false
// $count = how many posts. Default from recent.count (see config.ini)

recent_posts($custom = null, $count = null)

**Custom Recent Posts

You can creating custom recent post by specify it inside the function.

recent_posts(true)

And it will outputting an array of the most recent posts. Than you need to do some foreach. Example from blog theme:

<div role="tabpanel" class="tab-pane active" id="recent-posts">
    <h2 class="hide">Recent Posts</h2>
    <?php $lists = recent_posts(true);?>
    <?php $char = 60;?>
    <?php foreach ($lists as $l):?>
        <?php if (strlen(strip_tags($l->title)) > $char) { $recentTitle = shorten($l->title, $char) . '...';} else {$recentTitle = $l->title;}?>
        <div class="item">
            <h3 class="title"><a href="<?php echo $l->url;?>"><?php echo $recentTitle;?></a></h3>
            <div class="content">
            <p><?php echo shorten($l->body, 75); ?>...</p>
            <a class="more-link" href="<?php echo $l->url;?>"><i class="fa fa-link"></i> Read more</a>
            </div><!--//content-->
        </div>
    <?php endforeach;?>
</div>

Above example also use shorten($string, $char) function.

The post count is specify by recent.count from config.ini but you can override it by specify it in your function, example:

recent_posts(true, 5)

Popular Posts

The popular posts also have the same function like recent posts, you just need to change the function to:

// $custom = true or false. Default false
// $count = how many posts. Default from popular.count (see config.ini)

popular_posts($custom = null, $count = null) 

Archive

This will display the archive widget.

// $custom = true or false. Default false.

archive_list($custom = null)

Tag Cloud

List of available tags.

// $custom = true or false. Default false.

tag_cloud($custom = null)

Custom Tag Cloud

By specify the $custom will outputting array. Example use:

<section id="popular-tags" class="widget widget_popular_tags">
<h2 class="widget-title">Popular Tags</h2>
    <?php $i = 1; $tags = tag_cloud(true); arsort($tags); ?>
    <ul>
    <?php foreach ($tags as $tag => $count):?>
        <li><a class="more-link" href="<?php echo site_url();?>tag/<?php echo $tag;?>"><?php echo tag_i18n($tag);?> (<?php echo $count;?>)</a></li>
    <?php if ($i++ >= 5) break;?>
    <?php endforeach;?>
    </ul>
</section>

Category List

This will displaying any category that have content.

// $custom = true or false. Default false
category_list($custom = null)

Related Posts

This will displayed related posts by tag. Only displaying post title linked to post.

get_related($p-&gt;related)

Custom Related Posts

Sometimes we need custom related posts, we just need to specify.

get_related($p-&gt;related, true)

Example:

<?php $related= get_related($p->related, true);?>

<?php foreach($related as $r):?>

// the div etc. goes here.

<div class="content">
    <div class="title"><?php echo $r->title; ?></div>
    //etc....
</div>

<?php endforeach;?>

Recent Posts by Type

We can list let say latest image, video etc. or category and author

// $type = the content type eg. image, video, category (slug), author (username) etc.
// $count = how many posts. Default is recent.count (see config.ini)
// $custom = true or false

recent_type($type, $count = null, $custom = null)

Recent Posts by Tag

We can list latest posts by tag

// $tag = the tag slug
// $count = how many posts. Default is recent.count (see config.ini)
// $custom = true or false

recent_tag($tag, $count = null, $custom = null)