';
}
}
//Displays the author link
if(!function_exists('cpotheme_postpage_author')){
function cpotheme_postpage_author($display = false, $format_text =''){
$author_alt = sprintf(esc_attr__('View all posts by %s', 'cpocore'), get_the_author());
$author = sprintf('%3$s', get_author_posts_url(get_the_author_meta('ID')), $author_alt,get_the_author());
if($format_text != ''){
$author = sprintf($format_text, $author);
}
echo '
'.$author.'
';
}
}
//Displays the category list for the current post
if(!function_exists('cpotheme_postpage_categories')){
function cpotheme_postpage_categories($display = false, $format_text =''){
$category_list = get_the_category_list(', ');
if($format_text != ''){
$category_list = sprintf($format_text, $category_list);
}
echo '
'.$category_list.'
';
}
}
//Displays the number of comments for the post
if(!function_exists('cpotheme_postpage_comments')){
function cpotheme_postpage_comments($display = false, $format_text = ''){
$comments_num = get_comments_number();
//Format comment texts
if($format_text != ''){
$text = $format_text;
}else{
if($comments_num == 0)
$text = __('No Comments', 'cpocore');
elseif($comments_num == 1)
$text = __('One Comment', 'cpocore');
else
$text = __('%1$s Comments', 'cpocore');
}
$comments = sprintf($text, number_format_i18n($comments_num));
echo '
';
}
}
//Displays the post tags
if(!function_exists('cpotheme_postpage_tags')){
function cpotheme_postpage_tags($display = false, $before = '', $separator = ', ', $after = ''){
echo '
';
the_tags($before, $separator, $after);
echo '
';
}
}
//Display Read More link for post excerpts
if(!function_exists('cpotheme_postpage_readmore')){
function cpotheme_postpage_readmore($classes = ''){
return ''.apply_filters('cpotheme_readmore', __('Read More', 'cpotheme')).'';
}
}
//Displays the author link
if(!function_exists('cpotheme_author_links')){
function cpotheme_author_links(){
echo '
';
echo $out;
}
}
//Paginates a list of posts, such as the blog or portfolio
if(!function_exists('cpotheme_numbered_pagination')){
function cpotheme_numbered_pagination($query = ''){
global $wp_query;
if($query != '')
$total_pages = $query->max_num_pages;
else
$total_pages = $wp_query->max_num_pages;
if($total_pages > 1){
echo '
';
}
}
}
//Paginates a single post by using a numbered list
if(!function_exists('cpotheme_post_pagination')){
function cpotheme_post_pagination(){
wp_link_pages(array('before' => '
', 'after' => '
', 'pagelink' => '%', 'separator' => ''));
}
}
//Prints the main navigation menu
if(!function_exists('cpotheme_menu')){
function cpotheme_menu($options = null){
if(has_nav_menu('main_menu')){
if(isset($options['toggle']) && $options['toggle'] == true) cpotheme_menu_toggle();
wp_nav_menu(array('menu_id' => 'menu-main', 'menu_class' => 'menu-main nav_main', 'theme_location' => 'main_menu', 'depth' => '4', 'container' => false, 'walker' => new Cpotheme_Menu_Walker()));
}
}
}
//Prints the mobile navigation menu
if(!function_exists('cpotheme_mobile_menu')){
add_action('wp_footer', 'cpotheme_mobile_menu');
function cpotheme_mobile_menu($options = null){
if(has_nav_menu('main_menu')){
echo '';
wp_nav_menu(array('menu_id' => 'menu-mobile', 'menu_class' => 'menu-mobile', 'theme_location' => 'main_menu', 'depth' => '4', 'container' => false, 'walker' => new Cpotheme_Menu_Walker()));
}
}
}
//Prints the main navigation menu
if(!function_exists('cpotheme_menu_toggle')){
function cpotheme_menu_toggle(){
if(has_nav_menu('main_menu'))
echo '';
}
}
//Prints the footer navigation menu
if(!function_exists('cpotheme_top_menu')){
function cpotheme_top_menu(){
if(has_nav_menu('top_menu')){
echo '
';
}
}
}
//Prints the footer navigation menu
if(!function_exists('cpotheme_footer_menu')){
function cpotheme_footer_menu(){
if(has_nav_menu('footer_menu')){
echo '';
}
}
}
//Displays a dropdown list of the main menu items
if(!function_exists('cpotheme_mobile_menu')){
function cpotheme_mobile_menu(){
if(has_nav_menu('main_menu')){
//Get all custom menus, then retrieve the one set to the main menu
$menu_locations = get_nav_menu_locations();
$menu_object = wp_get_nav_menu_object($menu_locations['main_menu']);
if($menu_object){
$menu_items = wp_get_nav_menu_items($menu_object->term_id);
$current_parent = array();
$current_level = 0;
$last_id = 'root';
$output = '';
$output .= '';
echo $output;
}
}else{
//Default page list
$args = array('sort_column' => 'menu_order');
$menu_items = get_pages($args);
$current_parent = array();
$current_level = 0;
$last_id = -1;
$output = '';
$output .= '