4000,
)
);
if($get_gallery) { ?>
' . get_field('caeliora_acf_post_teaser') . '';
} else {
if(is_single()) {
echo '' . get_field('caeliora_acf_post_teaser') . '
';
}
}
}
}
}
}
}
/*
* Set post format
* Will automatically set the post format depending on the ACF post format setting
*/
if (class_exists('ACF')) {
function caeliora_assign_post_format($post_id) {
if(get_field('caeliora_acf_post_format', $post_id) == 'video') {
set_post_format($post_id, 'video');
} elseif(get_field('caeliora_acf_post_format', $post_id) == 'gallery') {
set_post_format($post_id, 'gallery');
} else {
set_post_format($post_id, 'standard');
}
}
add_action( 'save_post', 'caeliora_assign_post_format', 999, 1 );
}
/*
* Get post layout
*/
if(!function_exists('caeliora_get_post_layout')) {
function caeliora_get_post_layout() {
if (!class_exists('ACF')) {
/* If ACF is not installed then use default settings */
$get_post_format = 'standard';
$get_layout = get_theme_mod('caeliora_post_layout', 'layout1');
} else {
/* Get post format */
$get_post_format = get_field('caeliora_acf_post_format');
$get_post_format = isset($get_post_format) ? $get_post_format : 'standard';
if($get_post_format == 'video') {
/* Get standard video post layout */
if(get_field('caeliora_acf_video_post_layout')) {
if(get_field('caeliora_acf_video_post_layout') == 'default') {
$get_layout = get_theme_mod('caeliora_video_post_layout', 'layout1');
} else {
$get_layout = get_field('caeliora_acf_video_post_layout');
}
} else {
$get_layout = get_theme_mod('caeliora_video_post_layout', 'layout1');
}
} elseif($get_post_format == 'gallery') {
/* Get standard gallery post layout */
if(get_field('caeliora_acf_gallery_post_layout')) {
if(get_field('caeliora_acf_gallery_post_layout') == 'default') {
$get_layout = get_theme_mod('caeliora_gallery_post_layout', 'layout1');
} else {
$get_layout = get_field('caeliora_acf_gallery_post_layout');
}
} else {
$get_layout = get_theme_mod('caeliora_gallery_post_layout', 'layout1');
}
} else {
/* Get standard post layout */
if(get_field('caeliora_acf_post_layout')) {
if(get_field('caeliora_acf_post_layout') == 'default') {
$get_layout = get_theme_mod('caeliora_post_layout', 'layout1');
} else {
$get_layout = get_field('caeliora_acf_post_layout');
}
} else {
$get_layout = get_theme_mod('caeliora_post_layout', 'layout1');
}
}
}
$post_layout = array(
'layout' => $get_layout,
'format' => $get_post_format,
);
return $post_layout;
}
}
/*
* Get Content Layout (sidebar, full-width, full-width narrow)
*/
if(!function_exists('caeliora_get_content_layout')) {
function caeliora_get_content_layout() {
if (!class_exists('ACF')) {
/* If ACF is not installed then use default settings */
$get_content_layout = get_theme_mod('caeliora_post_content_layout', 'isSidebar');
} else {
if(get_field('caeliora_acf_post_content_layout')) {
if(get_field('caeliora_acf_post_content_layout') == 'default') {
$get_content_layout = get_theme_mod('caeliora_post_content_layout', 'isSidebar');
} else {
$get_content_layout = get_field('caeliora_acf_post_content_layout');
}
} else {
$get_content_layout = get_theme_mod('caeliora_post_content_layout', 'isSidebar');
}
}
return $get_content_layout;
}
}
if(!function_exists('caeliora_get_content_layout_flex')) {
function caeliora_get_content_layout_flex() {
if(!is_active_sidebar('sidebar-1') && caeliora_get_content_layout() === 'isFullwidth isNarrow') {
$get_content_layout = 'isFullwidth isNarrow';
} elseif(!is_active_sidebar('sidebar-1') && caeliora_get_content_layout() === 'isFullwidth') {
$get_content_layout = 'isFullwidth';
} elseif(!is_active_sidebar('sidebar-1') && caeliora_get_content_layout() === 'isSidebar') {
$get_content_layout = 'isFullwidth isNarrow';
} else {
$get_content_layout = caeliora_get_content_layout();
}
return $get_content_layout;
}
}
/*
* Get List/Grid Style
*/
if(!function_exists('caeliora_get_post_style')) {
function caeliora_get_post_style() {
if(is_archive()) {
if(get_theme_mod('caeliora_archive_layout', 'classic') == 'grid' || get_theme_mod('caeliora_archive_layout', 'classic') == 'classic_grid') {
$post_style = 'grid-' . get_theme_mod('caeliora_archive_layout_grid', 'style1');
} elseif(get_theme_mod('caeliora_archive_layout', 'classic') == 'list' || get_theme_mod('caeliora_archive_layout', 'classic') == 'classic_list') {
$post_style = 'list-' . get_theme_mod('caeliora_archive_layout_list', 'style1');
} else {
$post_style = 'classic-style1';
}
} elseif(is_search()) {
if(get_theme_mod('caeliora_search_layout', 'classic') == 'grid' || get_theme_mod('caeliora_search_layout', 'classic') == 'classic_grid') {
$post_style = 'grid-' . get_theme_mod('caeliora_search_layout_grid', 'style1');
} elseif(get_theme_mod('caeliora_search_layout', 'classic') == 'list' || get_theme_mod('caeliora_search_layout', 'classic') == 'classic_list') {
$post_style = 'list-' . get_theme_mod('caeliora_search_layout_list', 'style1');
} else {
$post_style = 'classic-style1';
}
} else {
if(get_theme_mod('caeliora_home_layout', 'classic') == 'grid' || get_theme_mod('caeliora_home_layout', 'classic') == 'classic_grid') {
$post_style = 'grid-' . get_theme_mod('caeliora_home_layout_grid', 'style1');
} elseif(get_theme_mod('caeliora_home_layout', 'classic') == 'list' || get_theme_mod('caeliora_home_layout', 'classic') == 'classic_list') {
$post_style = 'list-' . get_theme_mod('caeliora_home_layout_list', 'style1');
} else {
$post_style = 'classic-style1';
}
}
return $post_style;
}
}
/*
* Hide/Show Post elements
*/
/* Post Category */
if(!function_exists('caeliora_post_show_category')) {
function caeliora_post_show_category() {
if (!class_exists('ACF')) {
$show_category = get_theme_mod('caeliora_post_show_category', 'show');
} else {
if(get_field('caeliora_acf_post_show_category')) {
if(get_field('caeliora_acf_post_show_category') == 'default') {
$show_category = get_theme_mod('caeliora_post_show_category', 'show');
} else {
$show_category = get_field('caeliora_acf_post_show_category');
}
} else {
$show_category = get_theme_mod('caeliora_post_show_category', 'show');
}
}
return $show_category;
}
}
/* Post Title */
if(!function_exists('caeliora_post_show_title')) {
function caeliora_post_show_title() {
if (!class_exists('ACF')) {
$show_title = get_theme_mod('caeliora_post_show_title', 'show');
} else {
if(get_field('caeliora_acf_post_show_title')) {
if(get_field('caeliora_acf_post_show_title') == 'default') {
$show_title = get_theme_mod('caeliora_post_show_title', 'show');
} else {
$show_title = get_field('caeliora_acf_post_show_title');
}
} else {
$show_title = get_theme_mod('caeliora_post_show_title', 'show');
}
}
return $show_title;
}
}
/* Post Date */
if(!function_exists('caeliora_post_show_date')) {
function caeliora_post_show_date() {
if (!class_exists('ACF')) {
$show_date = get_theme_mod('caeliora_post_show_date', 'show');
} else {
if(get_field('caeliora_acf_post_show_date')) {
if(get_field('caeliora_acf_post_show_date') == 'default') {
$show_date = get_theme_mod('caeliora_post_show_date', 'show');
} else {
$show_date = get_field('caeliora_acf_post_show_date');
}
} else {
$show_date = get_theme_mod('caeliora_post_show_date', 'show');
}
}
return $show_date;
}
}
/* Post Author */
if(!function_exists('caeliora_post_show_author')) {
function caeliora_post_show_author() {
if (!class_exists('ACF')) {
$show_author = get_theme_mod('caeliora_post_show_author', 'show');
} else {
if(get_field('caeliora_acf_post_show_author')) {
if(get_field('caeliora_acf_post_show_author') == 'default') {
$show_author = get_theme_mod('caeliora_post_show_author', 'show');
} else {
$show_author = get_field('caeliora_acf_post_show_author');
}
} else {
$show_author = get_theme_mod('caeliora_post_show_author', 'show');
}
}
return $show_author;
}
}
/* Post Author Avatar */
if(!function_exists('caeliora_post_show_author_avatar')) {
function caeliora_post_show_author_avatar() {
if (!class_exists('ACF')) {
$show_author = get_theme_mod('caeliora_post_show_author_avatar', 'show');
} else {
if(get_field('caeliora_acf_post_show_author_avatar')) {
if(get_field('caeliora_acf_post_show_author_avatar') == 'default') {
$show_author = get_theme_mod('caeliora_post_show_author_avatar', 'show');
} else {
$show_author = get_field('caeliora_acf_post_show_author_avatar');
}
} else {
$show_author = get_theme_mod('caeliora_post_show_author_avatar', 'show');
}
}
return $show_author;
}
}
/* Post Meta Share Buttons */
if(!function_exists('caeliora_post_show_meta_share')) {
function caeliora_post_show_meta_share() {
if (!class_exists('ACF')) {
$show_readtime = get_theme_mod('caeliora_post_show_meta_share', 'show');
} else {
if(get_field('caeliora_acf_post_show_meta_share')) {
if(get_field('caeliora_acf_post_show_meta_share') == 'default') {
$show_readtime = get_theme_mod('caeliora_post_show_meta_share', 'show');
} else {
$show_readtime = get_field('caeliora_acf_post_show_meta_share');
}
} else {
$show_readtime = get_theme_mod('caeliora_post_show_meta_share', 'show');
}
}
return $show_readtime;
}
}
/* Leave a reply */
if(!function_exists('caeliora_post_show_leavereply')) {
function caeliora_post_show_leavereply() {
if (!class_exists('ACF')) {
$show_leavereply = get_theme_mod('caeliora_post_show_leavereply', 'show');
} else {
if(get_field('caeliora_acf_post_show_leavereply')) {
if(get_field('caeliora_acf_post_show_leavereply') == 'default') {
$show_leavereply = get_theme_mod('caeliora_post_show_leavereply', 'show');
} else {
$show_leavereply = get_field('caeliora_acf_post_show_leavereply');
}
} else {
$show_leavereply = get_theme_mod('caeliora_post_show_leavereply', 'show');
}
}
return $show_leavereply;
}
}
/* Top social buttons */
if(!function_exists('caeliora_post_show_social_top')) {
function caeliora_post_show_social_top() {
if (!class_exists('ACF')) {
$show_social_top = get_theme_mod('caeliora_post_show_social_top', 'show');
} else {
if(get_field('caeliora_acf_post_show_social_top')) {
if(get_field('caeliora_acf_post_show_social_top') == 'default') {
$show_social_top = get_theme_mod('caeliora_post_show_social_top', 'show');
} else {
$show_social_top = get_field('caeliora_acf_post_show_social_top');
}
} else {
$show_social_top = get_theme_mod('caeliora_post_show_social_top', 'show');
}
}
return $show_social_top;
}
}
/* Author box */
if(!function_exists('caeliora_post_show_author_box')) {
function caeliora_post_show_author_box() {
if (!class_exists('ACF')) {
$show_author_box = get_theme_mod('caeliora_post_show_author_box', 'show');
} else {
if(get_field('caeliora_acf_post_show_author_box')) {
if(get_field('caeliora_acf_post_show_author_box') == 'default') {
$show_author_box = get_theme_mod('caeliora_post_show_author_box', 'show');
} else {
$show_author_box = get_field('caeliora_acf_post_show_author_box');
}
} else {
$show_author_box = get_theme_mod('caeliora_post_show_author_box', 'show');
}
}
return $show_author_box;
}
}
/* Related tags */
if(!function_exists('caeliora_post_show_tags')) {
function caeliora_post_show_tags() {
if (!class_exists('ACF')) {
if(!get_theme_mod('caeliora_post_show_tags', true)) {
$show_tags = false;
} else {
$show_tags = 'show';
}
//$show_tags = get_theme_mod('caeliora_post_show_tags', 'show');
} else {
if(get_field('caeliora_acf_post_show_tags')) {
if(get_field('caeliora_acf_post_show_tags') == 'default') {
if(!get_theme_mod('caeliora_post_show_tags', true)) {
$show_tags = false;
} else {
$show_tags = 'show';
}
//$show_related = get_theme_mod('caeliora_post_show_tags', 'show');
} else {
$show_tags = get_field('caeliora_acf_post_show_tags');
}
} else {
if(!get_theme_mod('caeliora_post_show_tags', true)) {
$show_tags = false;
} else {
$show_tags = 'show';
}
//$show_tags = get_theme_mod('caeliora_post_show_tags', 'show');
}
}
return $show_tags;
}
}
/* Related posts */
if(!function_exists('caeliora_post_show_related')) {
function caeliora_post_show_related() {
if (!class_exists('ACF')) {
$show_related = get_theme_mod('caeliora_post_show_related', 'show');
} else {
if(get_field('caeliora_acf_post_show_related')) {
if(get_field('caeliora_acf_post_show_related') == 'default') {
$show_related = get_theme_mod('caeliora_post_show_related', 'show');
} else {
$show_related = get_field('caeliora_acf_post_show_related');
}
} else {
$show_related = get_theme_mod('caeliora_post_show_related', 'show');
}
}
return $show_related;
}
}
/* Post Pagination */
if(!function_exists('caeliora_post_show_pagination')) {
function caeliora_post_show_pagination() {
if (!class_exists('ACF')) {
$show_pagination = get_theme_mod('caeliora_post_show_pagination', 'show');
} else {
if(get_field('caeliora_acf_post_show_pagination')) {
if(get_field('caeliora_acf_post_show_pagination') == 'default') {
$show_pagination = get_theme_mod('caeliora_post_show_pagination', 'show');
} else {
$show_pagination = get_field('caeliora_acf_post_show_pagination');
}
} else {
$show_pagination = get_theme_mod('caeliora_post_show_pagination', 'show');
}
}
return $show_pagination;
}
}
/* Excerpt functions */
if(!function_exists('custom_excerpt_length')) {
function custom_excerpt_length( $length ) {
return 135;
}
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
if(!function_exists('caeliora_excerpt')) {
function caeliora_excerpt($limit) {
return ''.wp_trim_words(get_the_excerpt(), $limit).'
';
}
}
if(!function_exists('sitka_excerpt')) {
function sitka_excerpt($limit) {
return ''.wp_trim_words(get_the_excerpt(), $limit).'
';
}
}