= 2 || $page >= 2)
$full_title .= ' | '.sprintf( __('Page %s', 'cpotheme'), max($paged, $page));
echo $full_title;
}
//Display custom favicon
add_action('wp_head','cpotheme_favicon');
function cpotheme_favicon(){
$favicon_url = cpotheme_get_option('cpo_general_favicon');
if($favicon_url != '')
echo ' ';
}
//Display custom favicon
add_action('wp_head','cpotheme_viewport');
function cpotheme_viewport(){
echo ' ';
}
//Display shortcut edit links for logged in users
function cpotheme_edit(){
if(cpotheme_get_option('cpo_general_editlinks'))
edit_post_link(' '.__('Edit', 'cpotheme'));
}
//Display the site's logo
function cpotheme_logo($width, $height){
$output = '
';
if(cpotheme_get_option('cpo_general_texttitle') == 0){
if(cpotheme_get_option('cpo_general_logo') == '')
$output .= '
';
else
$output .= '
';
}
$classes = '';
if(cpotheme_get_option('cpo_general_texttitle') == 0) $classes = ' hidden';
if(is_singular() && !is_front_page()){
$output .= '
'.get_bloginfo('name').' ';
}else{
$output .= '
';
}
$output .= '
';
echo $output;
}
//Display language switcher
function cpotheme_languages(){
if(cpotheme_get_option('cpo_layout_languages') == 1 && function_exists('icl_get_languages')):
$output = '';
echo $output;
endif;
}
//Display social links
function cpotheme_social(){
$output = '';
$output .= cpotheme_social_item(cpotheme_get_option('cpo_social_facebook'), 'Facebook', 'facebook');
$output .= cpotheme_social_item(cpotheme_get_option('cpo_social_twitter'), 'Twitter', 'twitter');
$output .= cpotheme_social_item(cpotheme_get_option('cpo_social_gplus'), 'Google Plus', 'google-plus');
$output .= cpotheme_social_item(cpotheme_get_option('cpo_social_youtube'), 'YouTube', 'youtube');
$output .= cpotheme_social_item(cpotheme_get_option('cpo_social_linkedin'), 'LinkedIn', 'linkedin');
$output .= cpotheme_social_item(cpotheme_get_option('cpo_social_pinterest'), 'Pinterest', 'pinterest');
$output .= cpotheme_social_item(cpotheme_get_option('cpo_social_foursquare'), 'Foursquare', 'foursquare');
$output .= cpotheme_social_item(cpotheme_get_option('cpo_social_tumblr'), 'Tumblr', 'tumblr');
$output .= cpotheme_social_item(cpotheme_get_option('cpo_social_flickr'), 'Flickr', 'flickr');
$output .= cpotheme_social_item(cpotheme_get_option('cpo_social_instagram'), 'Instagram', 'instagram');
$output .= cpotheme_social_item(cpotheme_get_option('cpo_social_dribbble'), 'Dribbble', 'dribbble');
$output .= cpotheme_social_item(cpotheme_get_option('cpo_social_skype'), 'Skype', 'skype');
$output .= '
';
echo $output;
}
function cpotheme_social_item($url, $title = '', $icon = ''){
if($url != ''):
$output = '';
if($icon != '') $output .= ' ';
if($title != '') $output .= ''.$title.' ';
$output .= ' ';
return $output;
endif;
}
//Display custom font stylesheets from Google Fonts
function cpotheme_fonts($font_name){
echo ' ';
}
//Adds custom javascript code in the footer
add_action('wp_footer', 'cpotheme_layout_js');
function cpotheme_layout_js(){
$output = cpotheme_get_option('cpo_general_js');
if($output != ''){
$output = '';
echo $output;
}
}
//Adds custom css code in the footer
add_action('wp_head','cpotheme_layout_css', 25);
function cpotheme_layout_css(){
$output = cpotheme_get_option('cpo_general_css');
if($output != ''){
$output = '';
echo $output;
}
}
//Abstracted function for retrieving specific options inside option arrays
function cpotheme_get_option($option_name = '', $option_array = 'cpotheme_settings'){
$option_list_name = $option_array.cpotheme_wpml_current_language();
$option_list = get_option($option_list_name, false);
if($option_list && isset($option_list[$option_name]))
$option_value = $option_list[$option_name];
else
$option_value = false;
return $option_value;
}
//Abstracted function for updating specific options inside arrays
function cpotheme_update_option($option_name, $option_value, $option_array = 'cpotheme_settings'){
$option_list_name = $option_array.cpotheme_wpml_current_language();
$option_list = get_option($option_list_name, false);
if(!$option_list)
$option_list = array();
$option_list[$option_name] = $option_value;
if(update_option($option_list_name, $option_list))
return true;
else
return false;
}
//Returns the current language's code in the event that WPML is active
function cpotheme_wpml_current_language(){
$language_code = '';
if(cpotheme_custom_wpml_active()){
$default_language = cpotheme_custom_wpml_default_language();
$active_language = ICL_LANGUAGE_CODE;
if($active_language != $default_language)
$language_code = '_'.$active_language;
}
return $language_code;
}
function cpotheme_sidebar_position(){
if(cpotheme_get_option('cpo_sidebar_position') == 'left') echo 'content-right';
}
// Generates breadcrumb navigation
function cpotheme_breadcrumb(){
if(cpotheme_get_option('cpo_layout_breadcrumbs') && !is_home() && !is_front_page()):
if(function_exists('yoast_breadcrumb')):
$result = yoast_breadcrumb('','', false);
else:
global $post;
if(is_object($post)) $pid = $post->ID; else $pid = '';
$result = '';
if($pid != ''):
if(is_singular()):
$post_data = get_post($pid);
$result = "".apply_filters('the_title', $post_data->post_title)." \n";
if(is_singular('cpo_portfolio') && cpotheme_get_option('cpo_postpage_portfolio') != 0):
$selected_page = get_post(cpotheme_get_option('cpo_postpage_portfolio'));
$result = ''.$selected_page->post_title.' '.$result;
endif;
if(is_singular('post') && cpotheme_get_option('cpo_postpage_blog') != 0):
$selected_page = get_post(cpotheme_get_option('cpo_postpage_blog'));
$result = ''.$selected_page->post_title.' '.$result;
endif;
while($post_data->post_parent):
$post_data = get_post($post_data->post_parent);
$result = "".apply_filters('the_title', $post_data->post_title)." \n".$result;
endwhile;
elseif(is_category()):
if(is_singular('post') && cpotheme_get_option('cpo_postpage_blog') != 0):
$selected_page = get_post(cpotheme_get_option('cpo_postpage_blog'));
$result = ''.$selected_page->post_title.' '.$result;
endif;
$post_data = get_the_category($pid);
if(isset($post_data[0])):
$data = get_category_parents($post_data[0]->cat_ID, TRUE, ' » ');
if(!is_object($data)):
$result = ''.substr($data, 0, -8).$result;
endif;
endif;
endif;
endif;
$result = ''.__('Home', 'cpotheme').' '.$result;
endif;
$output = ''.$result.'
';
echo $output;
endif;
}
//Displays the post date
function cpotheme_postpage_date($format = ''){
if(cpotheme_get_option('cpo_postpage_dates') != 0){
if($format = '') $format = get_option('date_format');
echo ''.get_the_date($format).'
';
}
}
//Displays the author link
function cpotheme_postpage_author(){
if(cpotheme_get_option('cpo_postpage_authors') != 0){
$author_alt = sprintf(esc_attr__('View all posts by %s', 'cpotheme'), get_the_author());
$author = sprintf('%3$s ', get_author_posts_url(get_the_author_meta('ID')), $author_alt, get_the_author());
echo ''.$author.'
';
}
}
//Displays the category list for the current post
function cpotheme_postpage_categories(){
if(cpotheme_get_option('cpo_postpage_categories') != 0){
echo ''.get_the_category_list(', ').'
';
}
}
//Displays the number of comments for the post
function cpotheme_postpage_comments(){
if(cpotheme_get_option('cpo_postpage_comments') != 0){
$comments_num = get_comments_number();
if($comments_num == 0)
$comments = __('No Comments', 'cpotheme');
elseif($comments_num == 1)
$comments = __('One Comment', 'cpotheme');
else
$comments = sprintf(__('%1$s Comments', 'cpotheme'), number_format_i18n($comments_num));
echo '';
}
}
//Displays the post tags
function cpotheme_postpage_tags(){
if(cpotheme_get_option('cpo_postpage_tags') != 0){
$tag_list = get_the_tag_list('');
if($tag_list):
echo $tag_list;
endif;
}
}
//Displays a slideshow of the given query
function cpotheme_post_slideshow($args, $options = null){
$attachments = get_posts($args);
$thumb_count = 0;
if($attachments){ ?>
>
ID, true); ?>
post_excerpt != ''): ?>
post_excerpt; ?>
'; ?>
post_excerpt != ''): ?>
post_excerpt; ?>
ID, 'portfolio_large'); ?>
ID, 'full'); ?>
'menu-main', 'menu_class' => 'menu-main nav_main', 'theme_location' => 'main_menu', 'depth' => '4', 'container' => false, 'walker' => new Cpotheme_Menu_Walker()));
else
wp_nav_menu(array('menu_id' => 'menu-main', 'menu_class' => 'menu-main nav_main', 'theme_location' => 'main_menu', 'depth' => '4'));
echo '
';
}
//Displays a dropdown list of the main menu items
function cpotheme_mobile_menu(){
if(has_nav_menu('main_menu') && cpotheme_get_option('cpo_layout_responsive') != 0){
//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 .= '