/**
* freddo functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package freddo
*/
if ( ! function_exists( 'freddo_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function freddo_setup() {
/*
* Define the number of items in some onepage sections (real value plus 1)
*/
define( 'FREDDO_VALUE_FOR_SLIDER', '4' );
define( 'FREDDO_VALUE_FOR_FEATURES', '5' );
define( 'FREDDO_VALUE_FOR_SKILLS', '11' );
define( 'FREDDO_VALUE_FOR_SERVICES', '7' );
define( 'FREDDO_VALUE_FOR_TEAM', '7' );
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on freddo, use a find and replace
* to change 'freddo' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'freddo', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded
tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
add_image_size( 'freddo-the-post-small' , 980, 600, true);
add_image_size( 'freddo-the-post-big' , 1920, 99999);
add_image_size( 'freddo-little-post' , 370, 220, true);
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'menu-1' => esc_html__( 'Primary', 'freddo' ),
) );
/*
* 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',
) );
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support( 'custom-logo', array(
'height' => 60,
'width' => 250,
'flex-width' => true,
'flex-height' => true,
'header-text' => array( 'site-title', 'site-description' ),
) );
/*
* Starter Content Support
*/
add_theme_support( 'starter-content', array(
'posts' => array(
'home' => array(
'template' => 'template-onepage.php',
),
'blog',
),
'options' => array(
'show_on_front' => 'page',
'page_on_front' => '{{home}}',
'page_for_posts' => '{{blog}}',
'freddo_theme_options[_onepage_section_slider]' => '1',
'freddo_theme_options[_onepage_image_1_slider]' => get_template_directory_uri().'/images/example/freddo_slider_example_1.jpg',
'freddo_theme_options[_onepage_image_2_slider]' => get_template_directory_uri().'/images/example/freddo_slider_example_2.jpg',
'freddo_theme_options[_onepage_text_1_slider]' => 'Welcome to Freddo Theme',
'freddo_theme_options[_onepage_subtext_1_slider]' => 'Use the customizer to customize the onepage sections',
'freddo_theme_options[_onepage_text_2_slider]' => 'Read the documentation',
'freddo_theme_options[_onepage_subtext_2_slider]' => 'You can find the documentation in "Appearance-> About Freddo-> Documentation"',
'freddo_theme_options[_onepage_section_skills]' => '1',
'freddo_theme_options[_onepage_skillname_1_skills]' => 'Design',
'freddo_theme_options[_onepage_skillvalue_1_skills]' => '84',
'freddo_theme_options[_onepage_skillname_2_skills]' => 'WordPress',
'freddo_theme_options[_onepage_skillvalue_2_skills]' => '93',
'freddo_theme_options[_onepage_skillname_3_skills]' => 'SEO',
'freddo_theme_options[_onepage_skillvalue_3_skills]' => '76',
'freddo_theme_options[_onepage_skillname_4_skills]' => 'Support',
'freddo_theme_options[_onepage_skillvalue_4_skills]' => '90',
'freddo_theme_options[_onepage_skillname_5_skills]' => 'Customization',
'freddo_theme_options[_onepage_skillvalue_5_skills]' => '89',
'freddo_theme_options[_onepage_skillname_6_skills]' => 'Updates',
'freddo_theme_options[_onepage_skillvalue_6_skills]' => '87',
'freddo_theme_options[_onepage_section_cta]' => '1',
'freddo_theme_options[_onepage_phrase_cta]' => 'Do you want more?',
'freddo_theme_options[_onepage_desc_cta]' => 'Take a look at Freddo PRO version...',
'freddo_theme_options[_onepage_textbutton_cta]' => 'PRO Version',
'freddo_theme_options[_onepage_urlbutton_cta]' => 'https://crestaproject.com/demo/freddo-pro/',
),
'nav_menus' => array(
'primary' => array(
'name' => __( 'Primary', 'freddo' ),
'items' => array(
'link_home',
'page_blog',
),
),
),
) );
}
endif;
add_action( 'after_setup_theme', 'freddo_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function freddo_content_width() {
$GLOBALS['content_width'] = apply_filters( 'freddo_content_width', 640 );
}
add_action( 'after_setup_theme', 'freddo_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function freddo_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Classic Sidebar', 'freddo' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'freddo' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '