/* * This theme styles the visual editor to resemble the theme style, * specifically font, colors, icons, and column width. */ /***************************************/ // / // CORE FUNCTIONALITY FUNCTIONS START / // / /***************************************/ // text_brightness_handler() --> određuje ispravnu boju texta ovisno o odabranom brightnessu function text_brightness_handler(){ if (get_sub_field('text_brightness') == '1') {echo 'color_color_5';} else if (get_sub_field('text_brightness') == '2') {echo 'color_color_1';} } // background_brightness_handler() --> određuje ispravnu boju pozadine ovisno o odabranom brightnessu function background_brightness_handler(){ if (get_sub_field('text_brightness') == '1') {echo 'background_color_5';} else if (get_sub_field('text_brightness') == '2') {echo 'background_color_1';} } // new_tab_handler() --> Provjerava dali se link treba otvoriti u novom tabu i ispisuje: target _blank function new_tab_handler(){ if (get_sub_field('new_tab') == '1') { } else {echo 'target="_blank"';} } // new_tab_head_handler() --> Provjerava dali se link u headeru treba otvoriti u novom tabu i ispisuje: target _blank function new_tab_head_handler(){ if (get_field('new_tab', 'option') == '1') { } else {echo 'target="_blank"';} } // background_color_inverter() --> Provjerava dali je invertana boja i sukladno pušta invertane klase function background_color_inverter(){ if (get_sub_field('color_sheme') == '1') {echo 'background_color_1';} else if (get_sub_field('color_sheme') == '2') {echo 'background_color_4';} } // text_color_inverter() --> Provjerava dali je invertana boja i sukladno pušta invertane klase function text_color_inverter(){ if (get_sub_field('color_sheme') == '1') {echo 'color_color_4';} else if (get_sub_field('color_sheme') == '2') {echo 'color_color_1';} } // footer_background_inverter() --> Provjerava dali je invertana boja i sukladno pušta invertane klase function footer_background_inverter(){ if (get_field("color_sheme", "option") == '1') {echo 'background_color_4';} else if (get_field("color_sheme", "option") == '2') {echo 'background_color_5';} } // footer_text_color_inverter() --> Provjerava dali je invertana boja i sukladno pušta invertane klase function footer_text_color_inverter(){ if (get_field("color_sheme", "option") == '1') {echo 'color_color_3';} else if (get_field("color_sheme", "option") == '2') {echo 'color_color_4';} } // footer_copytext_color_inverter() --> Provjerava dali je invertana boja i sukladno pušta invertane klase function footer_copytext_color_inverter(){ if (get_field("color_sheme", "option") == '1') {echo 'color_color_5';} else if (get_field("color_sheme", "option") == '2') {echo 'color_color_3';} } function footer_copytext_color_inverter_return(){ if (get_field("color_sheme", "option") == '1') {return 'color_color_5_f hover_color_3';} else if (get_field("color_sheme", "option") == '2') {return 'color_color_3_f hover_color_5';} } // cta_text_color_inverter() --> Provjerava dali je invertana boja i sukladno pušta invertane klase function cta_text_color_inverter(){ if (get_field("color_inverter", "option") == '1') { the_field("boja_5", "option");} else if (get_field("color_inverter", "option") == '2') { the_field("boja_1", "option");} } // cta_text_color_inverter_hover() --> Provjerava dali je invertana boja i sukladno pušta invertane klase function cta_text_color_inverter_hover(){ if (get_field("color_inverter", "option") == '1') { the_field("boja_1", "option");} else if (get_field("color_inverter", "option") == '2') { the_field("boja_5", "option");} } // border_radius_cta_handler() --> Provjerava dali je odabran rounded ili squared corner te postavlja na CTA function border_radius_cta_handler(){ if (get_field("corner_style", "option") == '1') {echo 'border-radius:6px!important';} else if (get_field("corner_style", "option") == '2') {echo 'border-radius:0px!important';} } // headline_text_color_inverter() --> Provjerava dali je invertana boja i sukladno pušta invertane klase function headline_text_color_inverter(){ if (get_sub_field("color_sheme") == '1') {echo 'color_color_3';} else if (get_sub_field("color_sheme") == '2') {echo 'color_color_1';} } /***************************************/ // / // CORE FUNCTIONALITY FUNCTIONS END / // / /***************************************/ /** * Set maximum content width */ if (!isset($content_width)) { $content_width = 1280; } /** * See: https://codex.wordpress.org/Function_Reference/add_theme_support */ function wp41boilerplate_setup() { /*$op_name_broj = 'options_broj_jezika'; $op_name_broj = mysql_real_escape_string($op_name_broj); global $wpdb; $results = $wpdb->get_results( "SELECT option_value FROM wp_options WHERE option_name = '$op_name_broj'", OBJECT ); foreach($results['0'] as $result) { $brojka = $result; } $curr_lang = 0; $meni_lokacija = array(); $lokacija = array();*/ /*while($curr_lang < $brojka) { $jezik_no = 'options_jezici_' . $curr_lang . '_jezik'; $jezik_no = mysql_real_escape_string($jezik_no); $results1 = $wpdb->get_results( "SELECT option_value FROM wp_options WHERE option_name = '$jezik_no'", OBJECT ); foreach($results1[0] as $resulti) { $jezik_puni = $resulti; } $nova_lokacija = array(strtolower($jezik_puni . '-header') => $jezik_puni . ' meni header', strtolower($jezik_puni . '-footer') => $jezik_puni . ' meni footer' ); $meni_lokacija = array_merge($meni_lokacija, $nova_lokacija); $curr_lang = $curr_lang + 1; }*/ register_nav_menus(array('meni-header' => 'Header menu', 'meni-footer' => 'Footer Menu')); add_theme_support('title-tag'); add_theme_support('html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption', 'widgets' )); add_theme_support('post-thumbnails'); //set_post_thumbnail_size($width, $height, $crop) add_image_size("gallery", 480, 350, true); add_image_size("blogbaner", 1920, 520, true); add_image_size("blogblok", 960, 400, true); add_image_size("shareimage", 1200, 630, true); //add_theme_support('automatic-feed-links'); //load_theme_textdomain('wp41boilerplate', get_template_directory() . '/languages'); } /** * Enqueue styles, scripts and threaded comments */ function wp41boilerplate_scripts() { wp_register_style('wp41boilerplate', get_template_directory_uri() . '/style.css', false, null); wp_enqueue_style('wp41boilerplate'); wp_register_style('wp41boilerplatefancy', get_template_directory_uri() . '/source/jquery.fancybox.css', false, null); wp_enqueue_style('wp41boilerplatefancy'); wp_enqueue_script('jquery'); wp_enqueue_script('jquery-ui-accordion', array('jquery')); //wp_register_script('wp41boilerplate-header', get_template_directory_uri() . '/js/header.js', false, null); //wp_enqueue_script('wp41boilerplate-header'); wp_register_script('wp41boilerplate-footer', get_template_directory_uri() . '/js/footer.js', false, null, true); wp_enqueue_script('wp41boilerplate-footer'); wp_register_script('wp41boilerplate-fancy', get_template_directory_uri() . '/source/jquery.fancybox.js', false, null, true); wp_enqueue_script('wp41boilerplate-fancy'); /* * Fetch posts using AJAX * wp_enqueue_script('wp41bp-ajax-fetch-posts', get_template_directory_uri() . '/js/wp41bp-ajax-fetch-posts.js', array('jquery'), null, true); wp_localize_script('wp41bp-ajax-fetch-posts', 'wp41bp_fetch_posts', array( 'ajaxurl' => admin_url('admin-ajax.php') )); /* *Conditional script(s) * if (is_page('pagenamehere')) { wp_register_script('wp41boilerplate-conditional', get_template_directory_uri() . '/js/conditional.js', false, null, true); wp_enqueue_script('wp41boilerplate-conditional'); } */ // Enable threaded comments if (!is_admin()) { if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } } } function cc_mime_types($mimes) { $mimes['eot'] = 'application/vnd.ms-fontobject'; $mimes['woff'] = 'application/font-woff'; $mimes['woff2'] = 'application/font-woff2'; $mimes['ttf'] = 'application/x-font-ttf'; return $mimes; } add_filter('upload_mimes', 'cc_mime_types'); /* ------ INCLUDE PLUGINS IN THEME ------*/ require_once dirname( __FILE__ ) . '/class-tgm-plugin-activation.php'; add_action( 'tgmpa_register', 'my_theme_register_required_plugins' ); function my_theme_register_required_plugins() { $plugins = array( array( 'name' => 'Gravity forms', 'slug' => 'gravityforms', 'source' => 'http://themeupdate.svinaweb.hr/plugins/gravityforms.zip', 'required' => true, 'force_activation' => true, 'external_url' => 'http://www.gravityforms.com/', ), /*array( 'name' => 'Duplicate post', 'slug' => 'duplicate-post', 'required' => true, 'force_activation' => true )*/ ); $config = array( 'id' => 'tgmpa', 'default_path' => '', 'menu' => 'tgmpa-install-plugins', 'parent_slug' => 'themes.php', 'capability' => 'edit_theme_options', 'has_notices' => true, 'dismissable' => true, 'dismiss_msg' => '', 'is_automatic' => false, 'message' => '', ); tgmpa( $plugins, $config ); } /* ------ INCLUDE ACF IN THEME ------ */ // 1. customize ACF path add_filter('acf/settings/path', 'my_acf_settings_path'); function my_acf_settings_path( $path ) { // update path $path = get_stylesheet_directory() . '/acf/'; // return return $path; } // 2. customize ACF dir add_filter('acf/settings/dir', 'my_acf_settings_dir'); function my_acf_settings_dir( $dir ) { // update path $dir = get_stylesheet_directory_uri() . '/acf/'; // return return $dir; } // 4. Include ACF include_once( get_stylesheet_directory() . '/acf/acf.php' ); include_once( get_stylesheet_directory() . '/duplicate-post/duplicate-post.php' ); /*add_filter('acf/settings/show_admin', '__return_false');*/ /* ------ OPTIONS PAGE ------ */ if( function_exists('acf_add_options_page') ) { acf_add_options_page(array( 'page_title' => 'Options', 'menu_title' => 'Options', 'menu_slug' => 'postavke_weba', 'capability' => 'edit_posts', 'icon_url' => 'http://themeupdate.svinaweb.hr/snwtema/favic.png', 'redirect' => false )); acf_add_options_sub_page(array( 'page_title' => 'Languages', 'menu_title' => 'Languages', 'parent_slug' => 'postavke_weba', )); } require 'theme-updates/theme-update-checker.php'; /* ------ GLOBALS ------ */ /* $example_update_checker = new ThemeUpdateChecker( 'snwtema', 'http://themeupdate.svinaweb.hr/snwtema/info.json' );*/ /* ------ MULTILINGUAL ON ------ */ /*function create_jezik() { if (!is_taxonomy('jezik')) { register_taxonomy( 'jezik', array('page', 'post'), array( 'hierarchical' => true, 'label' => __('Jezik'), 'public' => TRUE, 'show_ui' => TRUE, 'query_var' => 'jezik', 'rewrite' => true ) ); } }*/ /* function gbw_langs_init() { if (!is_taxonomy('jezik')) { register_taxonomy( 'jezik', array('page', 'post'), array( 'hierarchical' => true, 'label' => __('Jezik'), 'public' => TRUE, 'show_ui' => TRUE, 'query_var' => 'jezik', 'rewrite' => true ) ); } }*/ /* * Initialize / add more widgets to theme function wp41boilerplate_widgets_init() { register_sidebar(array( 'name' => __('Widget Area 1', 'wp41boilerplate'), 'id' => 'widget-area-1', 'description' => __('Drop widgets here to appear in your sidebar.', 'wp41boilerplate'), 'before_widget' => '
', 'before_title' => '