';
$output .= '
!['.esc_attr($thumb['alt']).']('.esc_url($thumb['url']).')
';
}
if (is_single($post)) {
$output = '
';
$fullimg = canopus_image('full', true);
$img = canopus_image($atts['img_size'], true);
$output .= '
';
if(!empty($img['caption'])){
$output .= '
'.esc_html($img['caption']).'';
}
} else {
$format = get_post_format();
if($format == 'video' &&($embed = trim(canopus_metabox('format_video_embed')))){
$output .= '
';
}
$output .= '
';
}
$output .= '
';
$output .= '
';
} elseif(!empty($atts['media_bgimage'])){
$format = get_post_format();
if($format == 'video' &&($embed = trim(canopus_metabox('format_video_embed')))){
$output .= '
';
$output .= '
';
$output .= '
';
$output .= '
';
} elseif($format == 'gallery' && ($image_ids = canopus_metabox('gallery_image_ids'))){
$images = explode(',', $image_ids);
wp_enqueue_script('owl-carousel');
$output .= '
';
$output .= '
';
foreach ($images as $image) {
if($image){
$img = wp_get_attachment_image_src($image, $atts['img_size']);
$output .= '
';
}
}
$output .= '
';
$output .= '
';
}
}
return $output;
}
function canopus_entry_media($format, $atts) {
global $post;
$output = '';
if (empty($atts['is_single']) && has_post_thumbnail($post->ID)) {
return canopus_standard_media($post, $atts);
}
switch ($format) {
case 'gallery':
$gallery = false;
$images = explode(',', canopus_metabox('gallery_image_ids'));
if ($images) {
wp_enqueue_script('owl-carousel');
$output .= '
';
$output .= '
';
foreach ($images as $image) {
if($image && $image!=='false'){
$gallery = true;
$origimg = wp_get_attachment_image_src($image, $atts['img_size']);
$output .= '
 . ')
';
}
}
$output .= '
';
$output .= '
';
}
if(!$gallery){
$output = canopus_standard_media($post, $atts);
}
break;
case 'video':
$embed = canopus_metabox('format_video_embed');
if (wp_oembed_get($embed)) {
$output .= '
';
$output .= wp_oembed_get($embed);
$output .= '
';
break;
} elseif (!empty($embed)) {
$output .= '
';
$output .= apply_filters("the_content", htmlspecialchars_decode($embed));
$output .= '
';
break;
} else {
$output = canopus_standard_media($post, $atts);
break;
}
case 'audio':
$mp3 = canopus_metabox('format_audio_mp3');
$embed = canopus_metabox('format_audio_embed');
if ($mp3) {
$output .= '
';
$output .= apply_filters("the_content", '[audio src="' . esc_url($mp3) . '"]');
$output .= '
';
break;
} elseif (wp_oembed_get($embed)) {
$output .= '
';
$output .= wp_oembed_get($embed);
$output .= '
';
break;
} elseif (!empty($embed)) {
$output .= '
';
$output .= apply_filters("the_content", htmlspecialchars_decode($embed));
$output .= '
';
break;
} else {
$output = canopus_standard_media($post, $atts);
break;
}
default :
$output = canopus_standard_media($post, $atts);
}
return $output;
}
function canopus_blogcontent($atts) {
global $more;
$more = 0;
if (has_excerpt()) {
the_excerpt();
} elseif (isset($atts['blog_excerpt']) && $atts['blog_excerpt'] != "") {
$more = 1;
echo apply_filters("the_content", canopus_excerpt(strip_shortcodes(wp_strip_all_tags(get_the_content(), true)), $atts['blog_excerpt']));
} else {
the_content($atts['more_text']);
}
}
function canopus_excerpt($str, $length) {
$str = explode(" ", strip_tags($str));
return implode(" ", array_slice($str, 0, $length));
}
add_filter('the_content_more_link', 'canopus_read_more_link', 10, 2);
function canopus_read_more_link($output, $read_more_text) {
$output = '
' . $read_more_text . '
';
return $output;
}
/* One Click other */
function canopus_import_files() {
return array(
array(
'import_file_name' => esc_html__('All Dummy Data', 'canopus'),
'import_file_url' => CANOPUS_DIR . '/dummy-data/all-dummy.xml',
'import_widget_file_url' => CANOPUS_DIR . '/dummy-data/widgets.json',
'import_preview_image_url' => CANOPUS_DIR . '/dummy-data/screenshot.jpg',
'import_redux' => array(
array(
'file_url' => CANOPUS_DIR . '/dummy-data/all-dummy.json',
'option_name' => 'canopus_redux',
),
),
'import_notice' => esc_html__('After you imported demo then set the Main menu and Edit Main Categories and enable the Customize options.', 'canopus'),
),
);
}
add_filter('pt-ocdi/import_files', 'canopus_import_files');
function canopus_after_import_setup() {
// Assign menus to their locations.
$main_menu = get_term_by('name', 'Main Menu', 'nav_menu');
set_theme_mod('nav_menu_locations', array(
'main' => $main_menu->term_id,
)
);
// Assign front page and posts page (blog page).
$front_page_id = get_page_by_title('Home');
update_option('show_on_front', 'page');
update_option('page_on_front', $front_page_id->ID);
}
add_action('pt-ocdi/after_import', 'canopus_after_import_setup');