ID) ? get_post_meta( $post->ID, CANOPUS_META, true ) : '';
if ( isset( $metabox[ $index ]) ) {
return $metabox[$index];
} else {
return $default;
}
}
function canopus_metaboxes(){
global $post;
if ($post) {
return get_post_meta( $post->ID, CANOPUS_META, true );
}
return false;
}
function canopus_favicon() {
if(!function_exists('wp_site_icon') || !has_site_icon()){
$fav = canopus_option('favicon');
if (!empty($fav['url'])) {
$favicon = $fav['url'];
} else {
$favicon = CANOPUS_DIR . 'assets/img/favicon.png';
}
echo '' . "\n";
}
}
// Print menu
//=======================================================
function canopus_menu() {
wp_nav_menu(array(
'container' => false,
'menu_id' => '',
'menu_class' => 'sf-menu',
'fallback_cb' => 'canopus_nomenu',
'theme_location' => 'main'
));
}
function canopus_footer_menu() {
wp_nav_menu(array(
'container' => 'div',
'container_class' => 'footer-menu',
'menu_id' => '',
'menu_class' => '',
'fallback_cb' => '',
'theme_location' => 'footer',
'depth' => '1'
));
}
function canopus_nomenu() {
echo "
";
}
function canopus_mobilemenu($loc = 'main') {
wp_nav_menu(array(
'container' => false,
'menu_id' => '',
'menu_class' => 'sf-mobile-menu clearfix',
'fallback_cb' => 'canopus_nomobile',
'theme_location' => $loc)
);
}
function canopus_nomobile() {
echo "";
wp_list_pages(array('title_li' => ''));
echo "
";
}
// Print logo
//=======================================================
function canopus_logo($mobile = false) {
$logo = canopus_option("logo");
$output = '';
return $output;
}
// Pagination
//=======================================================
function canopus_pagination($blog_query, $type = 'simple') {
global $paged;
$pages = intval($blog_query->max_num_pages);
$paged = ($paged) ? intval($paged) : 1;
if (empty($pages)) {
$pages = 1;
}
if($type == 'simple' && 1 != $pages){
echo '';
}elseif($type == 'number' && 1 != $pages){
$big = 9999; // need an unlikely integer
echo "";
}elseif($type == 'infinite' && 1 != $pages){
wp_enqueue_script('owl-carousel');
wp_enqueue_script('waypoints');
echo '';
}
}
function canopus_get_image_by_id($id,$url=false,$size='full'){
$lrg_img=wp_get_attachment_image_src($id,$size);
$output='';
if(isset($lrg_img[0])){
if($url){
$output.=$lrg_img[0];
}else{
$output.='
';
}
}
return $output;
}
if (!function_exists('canopus_image')) {
function canopus_image($size = 'full', $returnURL = false) {
global $post;
$attachment = get_post(get_post_thumbnail_id($post->ID));
if(!empty($attachment)){
if ($returnURL) {
$lrg_img = wp_get_attachment_image_src($attachment->ID, $size);
$url = $lrg_img[0];
$alt0 = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true);
$alt = empty($alt0)?$attachment->post_title:$alt0;
$caption = get_post( get_post_thumbnail_id() )->post_excerpt;
$img['url'] = $url;
$img['alt'] = $alt;
$img['caption'] = $caption;
return $img;
} else {
return get_the_post_thumbnail($post->ID,$size);
}
}
}
}
if (!function_exists('canopus_single_title')) {
function canopus_single_title(){
echo ''.get_the_title().'
';
if(canopus_option('single_meta', true)){
echo '';
}
}
}
if (!function_exists('canopus_author')) {
function canopus_author(){
$description = get_the_author_meta('description');
if ($description != ''){ ?>
';
$social_links=explode("\n",$socials);
foreach($social_links as $social_link){
$icon = canopus_social_icon(esc_url($social_link));
echo '
';
}
echo '
';
} ?>
'',
'email' => '',
'url' => '',
);
return $fields;
}
add_filter('comment_form_default_fields', 'canopus_comment_form');
}
if (!function_exists('canopus_comment')) {
function canopus_comment($comment, $args, $depth){
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
// Display trackbacks differently than normal comments.
?>
$depth, 'max_depth' => $args['max_depth']))) ?>