tbkcp_theme_functions.php

Summary
tbkcp_theme_functions.php
An assortment of re-usable theme functions
tbkcp_theme_functionsAn assortment of re-usable theme functions
Functions
get_nested_archivesGets a year/month list of archives
get_top_parentGets the top most parent page’s title and id
get_tag_listReturns a comma seperated list of all the post tag names
get_category_listReturns an array of linked post categories
get_child_or_sibling_pagesGet the child pages if on parent or sibling pages if in parent.
get_category_listReturn page/post/custom-post data by slug
get_breadcrumbsReturns a linked list of the breadcrumb trail
has_childrenChecks if a certian page/post/custom-post has children
wp_list_post_typesLists out post types in the wp_list_pages style (called by get_child_or_sibling_pages if custom post type detected)

An assortment of re-usable theme functions

  • Author: Paul MacLean*
  • Usage Examples:*
Most functions here will follow a similar format
global $included_modules;
if (class_exists('tbkcp_theme_functions')) {
$tbktf = $included_modules['tbkcp_theme_functions'];
$tbktf->your_function(your_parameters)
}

tbkcp_theme_functions

An assortment of re-usable theme functions

Summary
Functions
get_nested_archivesGets a year/month list of archives
get_top_parentGets the top most parent page’s title and id
get_tag_listReturns a comma seperated list of all the post tag names
get_category_listReturns an array of linked post categories
get_child_or_sibling_pagesGet the child pages if on parent or sibling pages if in parent.
get_category_listReturn page/post/custom-post data by slug
get_breadcrumbsReturns a linked list of the breadcrumb trail
has_childrenChecks if a certian page/post/custom-post has children
wp_list_post_typesLists out post types in the wp_list_pages style (called by get_child_or_sibling_pages if custom post type detected)

Functions

get_nested_archives

function get_nested_archives()

Gets a year/month list of archives

  • Usage Examples:*
global $included_modules;
if (class_exists('tbkcp_theme_functions')) {
$tbktf = $included_modules['tbkcp_theme_functions'];
echo $tbktf->get_nested_archives();
}

get_top_parent

function get_top_parent()

Gets the top most parent page’s title and id

  • Usage Examples:*
global $included_modules;
if (class_exists('tbkcp_theme_functions')) {
$tbktf = $included_modules['tbkcp_theme_functions'];
$top_parent = $tbktf->get_top_parent();
echo $top_parent['id'];
}

get_tag_list

function get_tag_list()

Returns a comma seperated list of all the post tag names

  • Usage Examples:*
global $included_modules;
if (class_exists('tbkcp_theme_functions')) {
$tbktf = $included_modules['tbkcp_theme_functions'];
$tag_list = $tbktf->get_tag_list();
echo $tag_list;
}

get_category_list

function get_category_list()

Returns an array of linked post categories

  • Usage Examples:*
global $included_modules;
if (class_exists('tbkcp_theme_functions')) {
$tbktf = $included_modules['tbkcp_theme_functions'];
$categories = $tbktf->get_category_list();
echo implode(',',$categories);
}

get_child_or_sibling_pages

function get_child_or_sibling_pages($new_args = array(),
$post =  null)

Get the child pages if on parent or sibling pages if in parent.  Can accept custom post types

  • Usage Examples:*
 global $included_modules;
 <ul>
 <?php
 global $included_modules;
 if (class_exists('tbkcp_theme_functions')) {
 $tbktf = $included_modules['tbkcp_theme_functions'];
 $args = array(
 'link_before' => '<span class="icon"></span>'
 );
 $tbktf->get_child_or_sibling_pages($args);
 }
 ?>
 </ul>

* Parameters*
 @$new_args: a set of wp_list_pages (wordpress) args
 @post : a specific post id. Defaults to global $post

get_category_list

Return page/post/custom-post data by slug

  • Usage Examples:*
global $included_modules;
if (class_exists('tbkcp_theme_functions')) {
$tbktf = $included_modules['tbkcp_theme_functions'];
echo $$tbktf->get_page_content('home');
}

get_breadcrumbs

function get_breadcrumbs()

Returns a linked list of the breadcrumb trail

  • Usage Examples:*
global $included_modules;
if (class_exists('tbkcp_theme_functions')) {
$tbktf = $included_modules['tbkcp_theme_functions'];
echo $tbktf->get_breadcrumbs();
}

has_children

function has_children($new_args = array())

Checks if a certian page/post/custom-post has children

  • Usage Examples:*
global $included_modules;
if (class_exists('tbkcp_theme_functions')) {
$tbktf = $included_modules['tbkcp_theme_functions'];
$args = array(
'post_type' => 'product'
);
$children = $tbktf->has_children($args);
}

wp_list_post_types

function wp_list_post_types($args)

Lists out post types in the wp_list_pages style (called by get_child_or_sibling_pages if custom post type detected)

  • Usage Examples:*
 global $included_modules;
 if (class_exists('tbkcp_theme_functions')) {
 $tbktf = $included_modules['tbkcp_theme_functions'];
 $tbktf->wp_list_post_types($args);
 }

* Parameters*
 @$args: a set of wp_list_pages (wordpress) args
function get_nested_archives()
Gets a year/month list of archives
function get_top_parent()
Gets the top most parent page’s title and id
function get_tag_list()
Returns a comma seperated list of all the post tag names
function get_category_list()
Returns an array of linked post categories
function get_child_or_sibling_pages($new_args = array(),
$post =  null)
Get the child pages if on parent or sibling pages if in parent.
function get_breadcrumbs()
Returns a linked list of the breadcrumb trail
function has_children($new_args = array())
Checks if a certian page/post/custom-post has children
function wp_list_post_types($args)
Lists out post types in the wp_list_pages style (called by get_child_or_sibling_pages if custom post type detected)
Close