esc_html__('Primary Menu', 'apadana'),
'footer' => esc_html__('Footer Menu', 'apadana'),
));
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support('html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
));
/**
* Enable support for Post Thumbnails, and declare two sizes.
*/
add_theme_support('post-thumbnails');
/*
* Enable support for Post Formats.
*/
add_theme_support('post-formats', array(
'aside',
'image',
'video',
'quote',
'link',
'gallery',
'audio',
));
$google_fonts = new apadana_custom_style();
add_editor_style(array(COLOSSEUM_CSS_PATH . 'style.css', $google_fonts->google_font_url()));
}
}
add_action('after_setup_theme', 'apadana_setup');
/**
*------------------------------------------------------------------------------------------
* 3 Add required script files ( css / Js and etc )
* ------------------------------------------------------------------------------------------
*/
if (!function_exists('apadana_scripts')) {
function apadana_scripts()
{
/**
* Add the css files of Apadana
*/
$main_style_type = get_theme_mod('apadana_option_main_style');
if (!empty($main_style_type)) {
switch (get_theme_mod('apadana_option_main_style')) {
case('2'):
wp_enqueue_style('apadana-main-style-file', COLOSSEUM_CSS_PATH . 'style-light.css');
break;
case('3'):
wp_enqueue_style('apadana-main-style-file', COLOSSEUM_CSS_PATH . 'style-1.css');
break;
default:
wp_enqueue_style('apadana-main-style-file', COLOSSEUM_CSS_PATH . 'style.css');
break;
}
} else {
wp_enqueue_style('apadana-main-style-file', COLOSSEUM_CSS_PATH . 'style.css');
}
/**
* Add the JS files of Apadana
*/
wp_enqueue_script("apadana-helper-js", COLOSSEUM_JS_PATH . 'helper.js', array('jquery'), get_bloginfo('version'), true);
wp_enqueue_script("apadana-template-js", COLOSSEUM_JS_PATH . 'app.js', array('jquery'), get_bloginfo('version'), true);
if (is_singular()) {
wp_enqueue_script("comment-reply");
}
$option_js_code = '';
$sticky_header_status = get_theme_mod('apadana_option_sticky_header');
if (!empty($sticky_header_status)) {
$option_js_code .= '
var mainHeader = jQuery("#main-header");
jQuery(window).on(\'scroll\', function () {
jQuery(document).scrollTop() > 30 ? mainHeader.addClass("sticky") : mainHeader.removeClass("sticky");
});
';
}
if (!empty($option_js_code)) {
wp_add_inline_script('apadana-template-js', $option_js_code);
}
$font_obj = new apadana_custom_style();
$font_obj->add_style();
}
}
add_action('wp_enqueue_scripts', 'apadana_scripts');
/**
* ------------------------------------------------------------------------------------------
* 4 - Pagination function
* ------------------------------------------------------------------------------------------
*/
include(COLOSSEUM_FUNCTIONS_PATH . 'pagination.php');
/**
* ------------------------------------------------------------------------------------------
* 5 - Breadcrumb function
* ------------------------------------------------------------------------------------------
*/
include(COLOSSEUM_FUNCTIONS_PATH . 'breadcrumb.php');
/**
* ------------------------------------------------------------------------------------------
* 6 - Register SideBars
* ------------------------------------------------------------------------------------------
*/
if (!function_exists('apadana_register_sidebar')) {
function apadana_register_sidebar()
{
register_sidebar(array(
'name' => esc_html__('Main Widget area', 'apadana'),
'id' => 'main-side-bar',
'description' => esc_html__('Appears to the right side of the blog page.', 'apadana'),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('Top Footer Widget area', 'apadana'),
'id' => 'top-footer',
'description' => esc_html__('Appears in top of the website footer.', 'apadana'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
));
}
}
add_action('widgets_init', 'apadana_register_sidebar');
/**
* ------------------------------------------------------------------------------------------
* 7 - Load post_types in the menu section
* ------------------------------------------------------------------------------------------
*/
include(COLOSSEUM_FUNCTIONS_PATH . 'post-type-in-menu.php');
/**
* ------------------------------------------------------------------------------------------
* 9 - Determine whether blog/site has more than one category.
* @return bool True of there is more than one category, false otherwise.
* ------------------------------------------------------------------------------------------
*/
function apadana_categorized_blog()
{
if (false === ($all_the_cool_cats = get_transient('apadana_categories'))) {
// Create an array of all the categories that are attached to posts.
$all_the_cool_cats = get_categories(array(
'fields' => 'ids',
'hide_empty' => 1,
// We only need to know if there is more than one category.
'number' => 2,
));
// Count the number of categories that are attached to the posts.
$all_the_cool_cats = count($all_the_cool_cats);
set_transient('apadana_categories', $all_the_cool_cats);
}
if ($all_the_cool_cats > 1) {
// This blog has more than 1 category so apadana_categorized_blog should return true.
return true;
} else {
// This blog has only 1 category so apadana_categorized_blog should return false.
return false;
}
}
/**
* ------------------------------------------------------------------------------------------
* 10 - Post Meta function
* ------------------------------------------------------------------------------------------
*/
include(COLOSSEUM_FUNCTIONS_PATH . 'post-meta.php');
/**
* ------------------------------------------------------------------------------------------
* 11 - Limit the search result for Posts
* ------------------------------------------------------------------------------------------
*/
if (!function_exists('apadana_search_filter')) {
function apadana_search_filter($query)
{
$page_in_search = get_theme_mod('apadana_option_search_in_page');
if (empty($page_in_search) && !is_admin()) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
return $query;
}
}
add_filter('pre_get_posts', 'apadana_search_filter');
/**
* ------------------------------------------------------------------------------------------
* 12 - Excerpt setting of blog
* ------------------------------------------------------------------------------------------
*/
include(COLOSSEUM_FUNCTIONS_PATH . 'excerpt-setting.php');
/**
* ------------------------------------------------------------------------------------------
* 13 - Link Posts links
* ------------------------------------------------------------------------------------------
*/
if (!function_exists('apadana_get_link_url')) {
function apadana_get_link_url()
{
$has_url = get_url_in_content(get_the_content());
return $has_url ? $has_url : apply_filters('the_permalink', get_permalink());
}
}
/**
* ------------------------------------------------------------------------------------------
* 14 - Breadcrumb background function
* It will be generated the background image of breadcrumb
* ------------------------------------------------------------------------------------------
*/
include(COLOSSEUM_FUNCTIONS_PATH . 'set-breadcrumb-bg.php');
/**
* ------------------------------------------------------------------------------------------
* 15 - Return the post URL
* @return string The Link format URL.
* ------------------------------------------------------------------------------------------
* @see get_url_in_content()
*/
if (!function_exists('apadana_get_link_url')) :
function apadana_get_link_url()
{
$has_url = get_url_in_content(get_the_content());
return $has_url ? $has_url : apply_filters('the_permalink', get_permalink());
}
endif;
/**
* ------------------------------------------------------------------------------------------
* 17 - Customizer required codes
* ------------------------------------------------------------------------------------------
*/
include(COLOSSEUM_FUNCTIONS_PATH . 'customizer.php');
/**
* ------------------------------------------------------------------------------------------
* 18 - Sanitize the inputs
* ------------------------------------------------------------------------------------------
*/
include(COLOSSEUM_FUNCTIONS_PATH . 'sanitize.php');
/**
* ------------------------------------------------------------------------------------------
* 19 - Customize the Login Page of WordPress
* ------------------------------------------------------------------------------------------
*/
include(COLOSSEUM_FUNCTIONS_PATH . 'login.class.php');
/**
* ------------------------------------------------------------------------------------------
* 20 - Custom Style
* ------------------------------------------------------------------------------------------
*/
include(COLOSSEUM_FUNCTIONS_PATH . 'custom-style.class.php');