/**
* ingener functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package ingener
*/
if ( ! defined( '_S_VERSION' ) ) {
// Replace the version number of the theme on each release.
define( '_S_VERSION', '1.0.0' );
}
if ( ! function_exists( 'ingener_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 ingener_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on ingener, use a find and replace
* to change 'ingener' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'ingener', 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' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus(
array(
'menu-1' => esc_html__( 'Primary', 'ingener' ),
)
);
/*
* 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',
'style',
'script',
)
);
// Set up the WordPress core custom background feature.
add_theme_support(
'custom-background',
apply_filters(
'ingener_custom_background_args',
array(
'default-color' => 'ffffff',
'default-image' => '',
)
)
);
// 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' => 250,
'width' => 250,
'flex-width' => true,
'flex-height' => true,
)
);
}
endif;
add_action( 'after_setup_theme', 'ingener_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 ingener_content_width() {
$GLOBALS['content_width'] = apply_filters( 'ingener_content_width', 640 );
}
add_action( 'after_setup_theme', 'ingener_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function ingener_widgets_init() {
register_sidebar(
array(
'name' => esc_html__( 'Sidebar', 'ingener' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'ingener' ),
'before_widget' => '',
'before_title' => '',
)
);
}
add_action( 'widgets_init', 'ingener_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function ingener_scripts() {
/* start STYLES */
// Font awesome CSS
wp_enqueue_style( 'fontawesome-all', get_template_directory_uri() . '/css/fontawesome/all.min.css', array(), _S_VERSION );
wp_enqueue_style( 'fontawesome-min', get_template_directory_uri() . '/css/fontawesome/fontawesome.min.css', array(), _S_VERSION );
// Bootstrap CSS
wp_enqueue_style( 'bootstrap-min', get_template_directory_uri() . '/css/bootstrap/bootstrap.min.css', array(), _S_VERSION );
wp_enqueue_style( 'bootstrap-grid', get_template_directory_uri() . '/css/bootstrap/bootstrap-grid.min.css', array(), _S_VERSION );
wp_enqueue_style( 'bootstrap-reboot', get_template_directory_uri() . '/css/bootstrap/bootstrap-reboot.min.css', array(), _S_VERSION );
// Slick slider CSS
wp_enqueue_style( 'slick-css', get_template_directory_uri() . '/css/slick/slick.css', array(), _S_VERSION );
// lightbox CSS
wp_enqueue_style( 'lightbox-css', get_template_directory_uri() . '/css/lightbox.css', array(), _S_VERSION );
// Main CSS
wp_enqueue_style( 'ingener-style', get_stylesheet_uri(), array(), _S_VERSION );
wp_style_add_data( 'ingener-style', 'rtl', 'replace' );
/* end STYLES */
/* start SCRIPTS */
wp_enqueue_script( 'ingener-navigation', get_template_directory_uri() . '/js/navigation.js', array(), _S_VERSION, true );
// jQuery JS
wp_enqueue_script( 'jQuery-js', get_template_directory_uri() . '/js/jQuery.js', array(), _S_VERSION, true );
// Slick JS
wp_enqueue_script( 'slick-js', get_template_directory_uri() . '/js/slick.min.js', array(), _S_VERSION, true );
// Main JS
wp_enqueue_script( 'main-js', get_template_directory_uri() . '/js/script.js', array(), _S_VERSION, true );
// Lightbox JS
wp_enqueue_script( 'lightbox-js', get_template_directory_uri() . '/js/lightbox.js', array(), _S_VERSION, true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
/* end SCRIPTS */
// Enqueue scripts and styles only for selected pages
global $post;
if( is_page() || is_single() ) {
switch($post->post_name)
{
// case 'contacts':
// wp_enqueue_script('contactsJS', get_template_directory_uri() . '/js/contacts.js', array(), _S_VERSION, true);
// break;
// case 'services':
// wp_enqueue_script('servicesJS', get_template_directory_uri() . '/js/services.js', array(), _S_VERSION, true);
// break;
}
}
if(is_front_page()) {
// wp_enqueue_script('homeJS', get_template_directory_uri() . '/js/home.js', array(), _S_VERSION, true);
}
}
add_action( 'wp_enqueue_scripts', 'ingener_scripts' );
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require get_template_directory() . '/inc/template-functions.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
if ( defined( 'JETPACK__VERSION' ) ) {
require get_template_directory() . '/inc/jetpack.php';
}
/* Add Option Page for Advanced Custom Field */
add_action('acf/init', 'my_acf_op_init');
function my_acf_op_init() {
// Check function exists.
if( function_exists('acf_add_options_sub_page') ) {
// Add parent.
$parent = acf_add_options_page(array(
'page_title' => 'Ingener Theme',
'menu_title' => 'Ingener Theme',
'icon_url' => 'dashicons-align-right', // Add this line and replace the second inverted commas with class of the icon you like
'position' => 29,
'redirect' => false,
));
// Add sub pages
$child = acf_add_options_sub_page(array(
'page_title' => 'Header',
'menu_title' => 'Header',
'parent_slug' => $parent['menu_slug'],
));
$child2 = acf_add_options_sub_page(array(
'page_title' => 'Footer',
'menu_title' => 'Footer',
'parent_slug' => $parent['menu_slug'],
));
}
}
/* Custom post type Services */
function post_services() {
$labels = array(
'name' => _x( 'Services', 'Post Type General Name', 'ingener' ),
'singular_name' => _x( 'Services', 'Post Type Singular Name', 'ingener' ),
'menu_name' => __( 'Services', 'ingener' ),
'name_admin_bar' => __( 'Services', 'ingener' ),
'archives' => __( 'Services Archives', 'ingener' ),
'attributes' => __( 'Services Attributes', 'ingener' ),
'parent_item_colon' => __( 'Parent Item:', 'ingener' ),
'all_items' => __( 'All Items', 'ingener' ),
'add_new_item' => __( 'Add New Item', 'ingener' ),
'add_new' => __( 'Add New', 'ingener' ),
'new_item' => __( 'New Item', 'ingener' ),
'edit_item' => __( 'Edit Item', 'ingener' ),
'update_item' => __( 'Update Item', 'ingener' ),
'view_item' => __( 'View Item', 'ingener' ),
'view_items' => __( 'View Items', 'ingener' ),
'search_items' => __( 'Search Item', 'ingener' ),
'not_found' => __( 'Not found', 'ingener' ),
'not_found_in_trash' => __( 'Not found in Trash', 'ingener' ),
'featured_image' => __( 'Featured Image', 'ingener' ),
'set_featured_image' => __( 'Set featured image', 'ingener' ),
'remove_featured_image' => __( 'Remove featured image', 'ingener' ),
'use_featured_image' => __( 'Use as featured image', 'ingener' ),
'insert_into_item' => __( 'Insert into item', 'ingener' ),
'uploaded_to_this_item' => __( 'Uploaded to this item', 'ingener' ),
'items_list' => __( 'Items list', 'ingener' ),
'items_list_navigation' => __( 'Items list navigation', 'ingener' ),
'filter_items_list' => __( 'Filter items list', 'ingener' ),
);
$args = array(
'label' => __( 'Services', 'ingener' ),
'description' => __( 'Post Type Description', 'ingener' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'menu_icon' => 'dashicons-feedback',
);
register_post_type( 'post-services', $args );
}
add_action( 'init', 'post_services', 0 );
/* Custom post type Projects */
function post_type_projects() {
$labels = array(
'name' => _x( 'Projects', 'Post Type General Name', 'in' ),
'singular_name' => _x( 'Projects', 'Post Type Singular Name', 'in' ),
'menu_name' => __( 'Projects', 'in' ),
'name_admin_bar' => __( 'Projects', 'in' ),
'archives' => __( 'Projects Archives', 'in' ),
'attributes' => __( 'Projects Attributes', 'in' ),
'parent_item_colon' => __( 'Parent Item:', 'in' ),
'all_items' => __( 'All Items', 'in' ),
'add_new_item' => __( 'Add New Item', 'in' ),
'add_new' => __( 'Add New', 'in' ),
'new_item' => __( 'New Item', 'in' ),
'edit_item' => __( 'Edit Item', 'in' ),
'update_item' => __( 'Update Item', 'in' ),
'view_item' => __( 'View Item', 'in' ),
'view_items' => __( 'View Items', 'in' ),
'search_items' => __( 'Search Item', 'in' ),
'not_found' => __( 'Not found', 'in' ),
'not_found_in_trash' => __( 'Not found in Trash', 'in' ),
'featured_image' => __( 'Featured Image', 'in' ),
'set_featured_image' => __( 'Set featured image', 'in' ),
'remove_featured_image' => __( 'Remove featured image', 'in' ),
'use_featured_image' => __( 'Use as featured image', 'in' ),
'insert_into_item' => __( 'Insert into item', 'in' ),
'uploaded_to_this_item' => __( 'Uploaded to this item', 'in' ),
'items_list' => __( 'Items list', 'in' ),
'items_list_navigation' => __( 'Items list navigation', 'in' ),
'filter_items_list' => __( 'Filter items list', 'in' ),
);
$args = array(
'label' => __( 'Projects', 'in' ),
'description' => __( 'Post Type Description', 'in' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'menu_icon' => 'dashicons-images-alt2',
);
register_post_type( 'post-projects', $args );
}
add_action( 'init', 'post_type_projects', 0 );
/* Custom post type Testimonials */
function post_type_testimonials() {
$labels = array(
'name' => _x( 'Testimonials', 'Post Type General Name', 'in' ),
'singular_name' => _x( 'Testimonials', 'Post Type Singular Name', 'in' ),
'menu_name' => __( 'Testimonials', 'in' ),
'name_admin_bar' => __( 'Testimonials', 'in' ),
'archives' => __( 'Testimonials Archives', 'in' ),
'attributes' => __( 'Testimonials Attributes', 'in' ),
'parent_item_colon' => __( 'Parent Item:', 'in' ),
'all_items' => __( 'All Items', 'in' ),
'add_new_item' => __( 'Add New Item', 'in' ),
'add_new' => __( 'Add New', 'in' ),
'new_item' => __( 'New Item', 'in' ),
'edit_item' => __( 'Edit Item', 'in' ),
'update_item' => __( 'Update Item', 'in' ),
'view_item' => __( 'View Item', 'in' ),
'view_items' => __( 'View Items', 'in' ),
'search_items' => __( 'Search Item', 'in' ),
'not_found' => __( 'Not found', 'in' ),
'not_found_in_trash' => __( 'Not found in Trash', 'in' ),
'featured_image' => __( 'Featured Image', 'in' ),
'set_featured_image' => __( 'Set featured image', 'in' ),
'remove_featured_image' => __( 'Remove featured image', 'in' ),
'use_featured_image' => __( 'Use as featured image', 'in' ),
'insert_into_item' => __( 'Insert into item', 'in' ),
'uploaded_to_this_item' => __( 'Uploaded to this item', 'in' ),
'items_list' => __( 'Items list', 'in' ),
'items_list_navigation' => __( 'Items list navigation', 'in' ),
'filter_items_list' => __( 'Filter items list', 'in' ),
);
$args = array(
'label' => __( 'Testimonials', 'in' ),
'description' => __( 'Post Type Description', 'in' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
'menu_icon' => 'dashicons-format-status'
);
register_post_type( 'post-testimonials', $args );
}
add_action( 'init', 'post_type_testimonials', 0 );
//
function custom_shortcode( ) {
return get_field("sales_section_percent");
}
add_shortcode( 'shortcode', 'custom_shortcode' );
?>