{"id":12072134,"date":"2019-10-28T11:13:30","date_gmt":"2019-10-28T11:13:30","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/function-php-adding-code\/"},"modified":"2019-10-28T11:13:30","modified_gmt":"2019-10-28T11:13:30","slug":"function-php-adding-code","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/function-php-adding-code\/","title":{"rendered":"Function.php adding code"},"content":{"rendered":"<p>Hi,<br \/>\ni&#8217;m not expert into php, but I usually add code.<br \/>\nBut adding your: &lt;?php echo do_shortcode(&#8220;[wcpcsu id=&#8217;3113&#8242;]&#8221;); ?&gt;<br \/>\nI receive this error:<\/p>\n<p>syntax error, unexpected &#8216;&lt;&#8216;, expecting end of file<\/p>\n<p>My function.php file contains already other code.<br \/>\nCould you please explain if I have to use all of your code or just a piece of it? Thanks<\/p>\n<p><strong>Here my Function.php existing code:<\/strong><br \/>\n<em>&lt;?php<br \/>\ninclude_once get_template_directory().&#8217;\/theme-includes.php&#8217;;<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_styles&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that includes theme&#8217;s core styles<br \/>\n     *\/<br \/>\n    function kloe_qodef_styles() {<br \/>\n        wp_register_style(&#8216;kloe_qodef_blog&#8217;, QODE_ASSETS_ROOT.&#8217;\/css\/blog.min.css&#8217;);<\/p>\n<p>        \/\/include theme&#8217;s core styles<br \/>\n        wp_enqueue_style(&#8216;kloe_qodef_default_style&#8217;, QODE_ROOT.&#8217;\/style.css&#8217;);<br \/>\n        wp_enqueue_style(&#8216;kloe_qodef_modules_plugins&#8217;, QODE_ASSETS_ROOT.&#8217;\/css\/plugins.min.css&#8217;);<br \/>\n        wp_enqueue_style(&#8216;kloe_qodef_modules&#8217;, QODE_ASSETS_ROOT.&#8217;\/css\/modules.min.css&#8217;);<\/p>\n<p>        kloe_qodef_icon_collections()-&gt;enqueueStyles();<\/p>\n<p>        if(kloe_qodef_load_blog_assets()) {<br \/>\n            wp_enqueue_style(&#8216;kloe_qodef_blog&#8217;);<br \/>\n        }<\/p>\n<p>        if(kloe_qodef_load_blog_assets() || is_singular(&#8216;portfolio-item&#8217;)) {<br \/>\n            wp_enqueue_style(&#8216;wp-mediaelement&#8217;);<br \/>\n        }<\/p>\n<p>        \/\/define files afer which style dynamic needs to be included. It should be included last so it can override other files<br \/>\n        $style_dynamic_deps_array = array();<\/p>\n<p>        if(kloe_qodef_is_woocommerce_installed()) {<br \/>\n            if(kloe_qodef_load_woo_assets()) {<br \/>\n                $style_dynamic_deps_array[] = &#8216;qode_woocommerce&#8217;;<br \/>\n            }<br \/>\n        }<\/p>\n<p>        \/\/is responsive option turned on?<br \/>\n        if(kloe_qodef_is_responsive_on()) {<br \/>\n            wp_enqueue_style(&#8216;kloe_qodef_modules_responsive&#8217;, QODE_ASSETS_ROOT.&#8217;\/css\/modules-responsive.min.css&#8217;);<br \/>\n            wp_enqueue_style(&#8216;kloe_qodef_blog_responsive&#8217;, QODE_ASSETS_ROOT.&#8217;\/css\/blog-responsive.min.css&#8217;);<\/p>\n<p>            \/\/is woocommerce installed?<br \/>\n            if(kloe_qodef_is_woocommerce_installed()) {<br \/>\n                if(kloe_qodef_load_woo_assets()) {<br \/>\n                    \/\/include theme&#8217;s woocommerce responsive styles<br \/>\n                     $style_dynamic_deps_array[] =&#8217;qode_woocommerce_responsive&#8217;;<br \/>\n                }<br \/>\n            }<\/p>\n<p>            \/\/include proper styles<br \/>\n            if(file_exists(QODE_ROOT_DIR.&#8217;\/assets\/css\/style_dynamic_responsive.css&#8217;) &amp;&amp; kloe_qodef_is_css_folder_writable() &amp;&amp; !is_multisite()) {<br \/>\n                wp_enqueue_style(&#8216;kloe_qodef_style_dynamic_responsive&#8217;, QODE_ASSETS_ROOT.&#8217;\/css\/style_dynamic_responsive.css&#8217;, array(), filemtime(QODE_ROOT_DIR.&#8217;\/assets\/css\/style_dynamic_responsive.css&#8217;));<br \/>\n            } else {<br \/>\n                wp_enqueue_style(&#8216;kloe_qodef_style_dynamic_responsive&#8217;, QODE_ASSETS_ROOT.&#8217;\/css\/style_dynamic_responsive.php&#8217;);<br \/>\n            }<br \/>\n        }<\/p>\n<p>        if(file_exists(QODE_ROOT_DIR.&#8217;\/assets\/css\/style_dynamic.css&#8217;) &amp;&amp; kloe_qodef_is_css_folder_writable() &amp;&amp; !is_multisite()) {<br \/>\n            wp_enqueue_style(&#8216;kloe_qodef_style_dynamic&#8217;, QODE_ASSETS_ROOT.&#8217;\/css\/style_dynamic.css&#8217;, $style_dynamic_deps_array, filemtime(QODE_ROOT_DIR.&#8217;\/assets\/css\/style_dynamic.css&#8217;)); \/\/it must be included after woocommerce styles so it can override it<br \/>\n        } else {<br \/>\n            wp_enqueue_style(&#8216;kloe_qodef_style_dynamic&#8217;, QODE_ASSETS_ROOT.&#8217;\/css\/style_dynamic.php&#8217;, $style_dynamic_deps_array); \/\/it must be included after woocommerce styles so it can override it<br \/>\n        }<\/p>\n<p>        \/\/include Visual Composer styles<br \/>\n        if(class_exists(&#8216;WPBakeryVisualComposerAbstract&#8217;)) {<br \/>\n            wp_enqueue_style(&#8216;js_composer_front&#8217;);<br \/>\n        }<br \/>\n    }<\/p>\n<p>    add_action(&#8216;wp_enqueue_scripts&#8217;, &#8216;kloe_qodef_styles&#8217;);<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_google_fonts_styles&#8217;)) {<br \/>\n\t\/**<br \/>\n\t * Function that includes google fonts defined anywhere in the theme<br \/>\n\t *\/<br \/>\n    function kloe_qodef_google_fonts_styles() {<br \/>\n        $font_simple_field_array = kloe_qodef_options()-&gt;getOptionsByType(&#8216;fontsimple&#8217;);<br \/>\n        if(!(is_array($font_simple_field_array) &amp;&amp; count($font_simple_field_array) &gt; 0)) {<br \/>\n            $font_simple_field_array = array();<br \/>\n        }<\/p>\n<p>        $font_field_array = kloe_qodef_options()-&gt;getOptionsByType(&#8216;font&#8217;);<br \/>\n        if(!(is_array($font_field_array) &amp;&amp; count($font_field_array) &gt; 0)) {<br \/>\n            $font_field_array = array();<br \/>\n        }<\/p>\n<p>        $available_font_options = array_merge($font_simple_field_array, $font_field_array);<br \/>\n        $font_weight_str        = &#8216;100,100italic,200,200italic,300,300italic,400,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic&#8217;;<\/p>\n<p>        \/\/define available font options array<br \/>\n        $fonts_array = array();<br \/>\n        foreach($available_font_options as $font_option) {<br \/>\n            \/\/is font set and not set to default and not empty?<br \/>\n            $font_option_value = kloe_qodef_options()-&gt;getOptionValue($font_option);<br \/>\n            if(kloe_qodef_is_font_option_valid($font_option_value) &amp;&amp; !kloe_qodef_is_native_font($font_option_value)) {<br \/>\n                $font_option_string = $font_option_value.&#8217;:&#8217;.$font_weight_str;<br \/>\n                if(!in_array($font_option_string, $fonts_array)) {<br \/>\n                    $fonts_array[] = $font_option_string;<br \/>\n                }<br \/>\n            }<br \/>\n        }<\/p>\n<p>        wp_reset_postdata();<\/p>\n<p>        $fonts_array         = array_diff($fonts_array, array(&#8216;-1:&#8217;.$font_weight_str));<br \/>\n        $google_fonts_string = implode(&#8216;|&#8217;, $fonts_array);<\/p>\n<p>        \/\/default fonts should be separated with %7C because of HTML validation<br \/>\n        $default_font_string = &#8216;Raleway:&#8217;.$font_weight_str.&#8217;|Poppins:&#8217;.$font_weight_str;<br \/>\n        $protocol = is_ssl() ? &#8216;https:&#8217; : &#8216;http:&#8217;;<\/p>\n<p>        \/\/is google font option checked anywhere in theme?<br \/>\n        if (count($fonts_array) &gt; 0) {<\/p>\n<p>            \/\/include all checked fonts<br \/>\n            $fonts_full_list = $default_font_string . &#8216;|&#8217; . str_replace(&#8216;+&#8217;, &#8216; &#8216;, $google_fonts_string);<br \/>\n            $fonts_full_list_args = array(<br \/>\n                &#8216;family&#8217; =&gt; urlencode($fonts_full_list),<br \/>\n                &#8216;subset&#8217; =&gt; urlencode(&#8216;latin,latin-ext&#8217;),<br \/>\n            );<\/p>\n<p>            $kloe_qodef_fonts = add_query_arg( $fonts_full_list_args, $protocol.&#8217;\/\/fonts.googleapis.com\/css&#8217; );<br \/>\n            wp_enqueue_style( &#8216;kloe_qodef_google_fonts&#8217;, esc_url_raw($kloe_qodef_fonts), array(), &#8216;1.0.0&#8217; );<\/p>\n<p>        } else {<br \/>\n            \/\/include default google font that theme is using<br \/>\n            $default_fonts_args = array(<br \/>\n                &#8216;family&#8217; =&gt; urlencode($default_font_string),<br \/>\n                &#8216;subset&#8217; =&gt; urlencode(&#8216;latin,latin-ext&#8217;),<br \/>\n            );<br \/>\n            $kloe_qodef_fonts = add_query_arg( $default_fonts_args, $protocol.&#8217;\/\/fonts.googleapis.com\/css&#8217; );<br \/>\n            wp_enqueue_style( &#8216;kloe_qodef_google_fonts&#8217;, esc_url_raw($kloe_qodef_fonts), array(), &#8216;1.0.0&#8217; );<br \/>\n        }<\/p>\n<p>    }<\/p>\n<p>\tadd_action(&#8216;wp_enqueue_scripts&#8217;, &#8216;kloe_qodef_google_fonts_styles&#8217;);<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_scripts&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that includes all necessary scripts<br \/>\n     *\/<br \/>\n    function kloe_qodef_scripts() {<br \/>\n        global $wp_scripts;<\/p>\n<p>        \/\/init theme core scripts<br \/>\n\t\twp_enqueue_script( &#8216;jquery-ui-core&#8217;);<br \/>\n\t\twp_enqueue_script( &#8216;jquery-ui-tabs&#8217;);<br \/>\n\t\twp_enqueue_script( &#8216;jquery-ui-accordion&#8217;);<br \/>\n\t\twp_enqueue_script( &#8216;wp-mediaelement&#8217;);<\/p>\n<p>        wp_enqueue_script(&#8216;kloe_qodef_third_party&#8217;, QODE_ASSETS_ROOT.&#8217;\/js\/third-party.min.js&#8217;, array(&#8216;jquery&#8217;), false, true);<br \/>\n        wp_enqueue_script(&#8216;isotope&#8217;, QODE_ASSETS_ROOT.&#8217;\/js\/jquery.isotope.min.js&#8217;, array(&#8216;jquery&#8217;), false, true);<\/p>\n<p>\t\tif(kloe_qodef_is_smoth_scroll_enabled()) {<br \/>\n\t\t\twp_enqueue_script(&#8220;kloe_qodef_smooth_page_scroll&#8221;, QODE_ASSETS_ROOT . &#8220;\/js\/smoothPageScroll.js&#8221;, array(), false, true);<br \/>\n\t\t}<\/p>\n<p>        \/\/include google map api script<br \/>\n        if(kloe_qodef_options()-&gt;getOptionValue(&#8216;google_maps_api_key&#8217;) != &#8221;) {<br \/>\n            $google_maps_api_key = kloe_qodef_options()-&gt;getOptionValue(&#8216;google_maps_api_key&#8217;);<br \/>\n            wp_enqueue_script(&#8216;google_map_api&#8217;, &#8216;\/\/maps.googleapis.com\/maps\/api\/js?key=&#8217; . $google_maps_api_key, array(), false, true);<br \/>\n        }<\/p>\n<p>        \/\/wp_enqueue_script(&#8216;qode_default&#8217;, QODE_ASSETS_ROOT.&#8217;\/js\/default.js&#8217;, array(), false, true);<br \/>\n        wp_enqueue_script(&#8216;kloe_qodef_modules&#8217;, QODE_ASSETS_ROOT.&#8217;\/js\/modules.min.js&#8217;, array(&#8216;jquery&#8217;), false, true);<\/p>\n<p>        if(kloe_qodef_load_blog_assets()) {<br \/>\n            wp_enqueue_script(&#8216;kloe_qodef_blog&#8217;, QODE_ASSETS_ROOT.&#8217;\/js\/blog.min.js&#8217;, array(&#8216;jquery&#8217;), false, true);<br \/>\n        }<\/p>\n<p>        \/\/include comment reply script<br \/>\n        $wp_scripts-&gt;add_data(&#8216;comment-reply&#8217;, &#8216;group&#8217;, 1);<br \/>\n        if(is_singular()) {<br \/>\n            wp_enqueue_script(&#8220;comment-reply&#8221;);<br \/>\n        }<\/p>\n<p>        \/\/include Visual Composer script<br \/>\n        if(class_exists(&#8216;WPBakeryVisualComposerAbstract&#8217;)) {<br \/>\n            wp_enqueue_script(&#8216;wpb_composer_front_js&#8217;);<br \/>\n        }<br \/>\n    }<\/p>\n<p>    add_action(&#8216;wp_enqueue_scripts&#8217;, &#8216;kloe_qodef_scripts&#8217;);<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_is_ajax_request&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that checks if the incoming request is made by ajax function<br \/>\n     *\/<br \/>\n    function kloe_qodef_is_ajax_request() {<\/p>\n<p>        return isset($_POST[&#8220;ajaxReq&#8221;]) &amp;&amp; $_POST[&#8220;ajaxReq&#8221;] == &#8216;yes&#8217;;<\/p>\n<p>    }<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_is_ajax_enabled&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that checks if ajax is enabled<br \/>\n     *\/<br \/>\n    function kloe_qodef_is_ajax_enabled() {<\/p>\n<p>        return kloe_qodef_options()-&gt;getOptionValue(&#8216;smooth_page_transitions&#8217;) === &#8216;yes&#8217; &amp;&amp; kloe_qodef_options()-&gt;getOptionValue(&#8216;smooth_pt_true_ajax&#8217;) != &#8216;no&#8217;;<\/p>\n<p>    }<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_ajax_meta&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that echoes meta data for ajax<br \/>\n     *<br \/>\n     * @since 4.3<br \/>\n     * @version 0.2<br \/>\n     *\/<br \/>\n    function kloe_qodef_ajax_meta() {<\/p>\n<p>        $id = kloe_qodef_get_page_id();<\/p>\n<p>        $page_transition = get_post_meta($id, &#8220;qodef_page_transition_type&#8221;, true);<\/p>\n<p>        ?&gt;<\/p>\n<p>        &lt;div class=&#8221;qodef-seo-title&#8221;&gt;&lt;?php echo wp_get_document_title(); ?&gt;&lt;\/div&gt;<\/p>\n<p>        &lt;?php if($page_transition !== &#8221;){ ?&gt;<br \/>\n            &lt;div class=&#8221;qodef-page-transition&#8221;&gt;&lt;?php echo esc_html($page_transition); ?&gt;&lt;\/div&gt;<br \/>\n        &lt;?php } else if(kloe_qodef_options()-&gt;getOptionValue(&#8216;default_page_transition&#8217;)) {?&gt;<br \/>\n            &lt;div class=&#8221;qodef-page-transition&#8221;&gt;&lt;?php echo esc_html(kloe_qodef_options()-&gt;getOptionValue(&#8216;default_page_transition&#8217;)); ?&gt;&lt;\/div&gt;<br \/>\n        &lt;?php }<br \/>\n    }<\/p>\n<p>    add_action(&#8216;kloe_qodef_ajax_meta&#8217;, &#8216;kloe_qodef_ajax_meta&#8217;);<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_no_ajax_pages&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that echoes pages on which ajax should not be applied<br \/>\n     *<br \/>\n     * @since 4.3<br \/>\n     * @version 0.2<br \/>\n     *\/<br \/>\n    function kloe_qodef_no_ajax_pages($global_variables) {<\/p>\n<p>        \/\/is ajax enabled?<br \/>\n        if(kloe_qodef_is_ajax_enabled()) {<br \/>\n            $no_ajax_pages = array();<\/p>\n<p>            \/\/get posts that have ajax disabled and merge with main array<br \/>\n            $no_ajax_pages = array_merge($no_ajax_pages, kloe_qodef_get_objects_without_ajax());<\/p>\n<p>            \/\/is wpml installed?<br \/>\n            if(kloe_qodef_is_wpml_installed()) {<br \/>\n                \/\/get translation pages for current page and merge with main array<br \/>\n                $no_ajax_pages = array_merge($no_ajax_pages, kloe_qodef_get_wpml_pages_for_current_page());<br \/>\n            }<\/p>\n<p>            \/\/is woocommerce installed?<br \/>\n            if(kloe_qodef_is_woocommerce_installed()) {<br \/>\n                \/\/get all woocommerce pages and products and merge with main array<br \/>\n                $no_ajax_pages = array_merge($no_ajax_pages, kloe_qodef_get_woocommerce_pages());<br \/>\n            }<br \/>\n            \/\/do we have some internal pages that want to be without ajax?<br \/>\n            if (kloe_qodef_options()-&gt;getOptionValue(&#8216;internal_no_ajax_links&#8217;) != &#8221;) {<br \/>\n                \/\/get array of those pages<br \/>\n                $options_no_ajax_pages_array = explode(&#8216;,&#8217;, kloe_qodef_options()-&gt;getOptionValue(&#8216;internal_no_ajax_links&#8217;));<\/p>\n<p>                if(is_array($options_no_ajax_pages_array) &amp;&amp; count($options_no_ajax_pages_array)) {<br \/>\n                    $no_ajax_pages = array_merge($no_ajax_pages, $options_no_ajax_pages_array);<br \/>\n                }<br \/>\n            }<\/p>\n<p>            \/\/add logout url to main array<br \/>\n            $no_ajax_pages[] = htmlspecialchars_decode(wp_logout_url());<\/p>\n<p>            $global_variables[&#8216;no_ajax_pages&#8217;] = $no_ajax_pages;<\/p>\n<p>        }<\/p>\n<p>        return $global_variables;<br \/>\n    }<\/p>\n<p>    add_filter(&#8216;kloe_qodef_js_global_variables&#8217;, &#8216;kloe_qodef_no_ajax_pages&#8217;);<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_get_objects_without_ajax&#8217;)) {<br \/>\n   \/**<br \/>\n     * Function that returns urls of objects that have ajax disabled.<br \/>\n     * Works for posts, pages and portfolio pages.<br \/>\n     * @return array array of urls of posts that have ajax disabled<br \/>\n     *<br \/>\n     * @version 0.1<br \/>\n     *\/<br \/>\n    function kloe_qodef_get_objects_without_ajax() {<br \/>\n        $posts_without_ajax = array();<\/p>\n<p>        $posts_args =  array(<br \/>\n            &#8216;post_type&#8217;  =&gt; array(&#8216;post&#8217;, &#8216;portfolio-item&#8217;, &#8216;page&#8217;),<br \/>\n            &#8216;post_status&#8217; =&gt; &#8216;publish&#8217;,<br \/>\n            &#8216;meta_key&#8217; =&gt; &#8216;qodef_page_transition_type&#8217;,<br \/>\n            &#8216;meta_value&#8217; =&gt; &#8216;no-animation&#8217;<br \/>\n        );<\/p>\n<p>        $posts_query = new WP_Query($posts_args);<\/p>\n<p>        if($posts_query-&gt;have_posts()) {<br \/>\n            while($posts_query-&gt;have_posts()) {<br \/>\n                $posts_query-&gt;the_post();<br \/>\n                $posts_without_ajax[] = get_permalink(get_the_ID());<br \/>\n            }<br \/>\n        }<\/p>\n<p>        wp_reset_postdata();<\/p>\n<p>        return $posts_without_ajax;<br \/>\n    }<br \/>\n}<\/p>\n<p>\/\/defined content width variable<br \/>\nif (!isset( $content_width )) $content_width = 1060;<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_theme_setup&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that adds various features to theme. Also defines image sizes that are used in a theme<br \/>\n     *\/<br \/>\n    function kloe_qodef_theme_setup() {<br \/>\n        \/\/add support for feed links<br \/>\n        add_theme_support(&#8216;automatic-feed-links&#8217;);<\/p>\n<p>        \/\/add support for post formats<br \/>\n        add_theme_support(&#8216;post-formats&#8217;, array(&#8216;gallery&#8217;, &#8216;link&#8217;, &#8216;quote&#8217;, &#8216;video&#8217;, &#8216;audio&#8217;));<\/p>\n<p>        \/\/add theme support for post thumbnails<br \/>\n        add_theme_support(&#8216;post-thumbnails&#8217;);<\/p>\n<p>        \/\/add theme support for title tag<br \/>\n        if(function_exists(&#8216;_wp_render_title_tag&#8217;)) {<br \/>\n            add_theme_support(&#8216;title-tag&#8217;);<br \/>\n        }<\/p>\n<p>        \/\/define thumbnail sizes<br \/>\n        add_image_size(&#8216;kloe_qodef_small_thumb&#8217;, 70, 55, true);<br \/>\n        add_image_size(&#8216;kloe_qodef_square&#8217;, 550, 550, true);<br \/>\n        add_image_size(&#8216;kloe_qodef_landscape&#8217;, 800, 600, true);<br \/>\n        add_image_size(&#8216;kloe_qodef_portrait&#8217;, 600, 800, true);<br \/>\n        add_image_size(&#8216;kloe_qodef_large_width&#8217;, 1000, 500, true);<br \/>\n        add_image_size(&#8216;kloe_qodef_large_height&#8217;, 500, 1000, true);<br \/>\n        add_image_size(&#8216;kloe_qodef_large_width_height&#8217;, 1000, 1000, true);<\/p>\n<p>        add_filter(&#8216;widget_text&#8217;, &#8216;do_shortcode&#8217;);<\/p>\n<p>        load_theme_textdomain( &#8216;kloe&#8217;, get_template_directory().&#8217;\/languages&#8217; );<br \/>\n    }<\/p>\n<p>    add_action(&#8216;after_setup_theme&#8217;, &#8216;kloe_qodef_theme_setup&#8217;);<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_rgba_color&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that generates rgba part of css color property<br \/>\n     *<br \/>\n     * @param $color string hex color<br \/>\n     * @param $transparency float transparency value between 0 and 1<br \/>\n     *<br \/>\n     * @return string generated rgba string<br \/>\n     *\/<br \/>\n    function kloe_qodef_rgba_color($color, $transparency) {<br \/>\n        if($color !== &#8221; &amp;&amp; $transparency !== &#8221;) {<br \/>\n            $rgba_color = &#8221;;<\/p>\n<p>            $rgb_color_array = kloe_qodef_hex2rgb($color);<br \/>\n            $rgba_color .= &#8216;rgba(&#8216;.implode(&#8216;, &#8216;, $rgb_color_array).&#8217;, &#8216;.$transparency.&#8217;)&#8217;;<\/p>\n<p>            return $rgba_color;<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_wp_title_text&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that sets page&#8217;s title. Hooks to wp_title filter<br \/>\n     *<br \/>\n     * @param $title string current page title<br \/>\n     * @param $sep string title separator<br \/>\n     *<br \/>\n     * @return string changed title text if SEO plugins aren&#8217;t installed<br \/>\n     *\/<br \/>\n    function kloe_qodef_wp_title_text($title, $sep) {<\/p>\n<p>        \/\/is SEO plugin installed?<br \/>\n        if(kloe_qodef_seo_plugin_installed()) {<br \/>\n            \/\/don&#8217;t do anything, seo plugin will take care of it<br \/>\n        } else {<br \/>\n            \/\/get current post id<br \/>\n            $id           = kloe_qodef_get_page_id();<br \/>\n            $sep          = &#8216; | &#8216;;<br \/>\n            $title_prefix = get_bloginfo(&#8216;name&#8217;);<br \/>\n            $title_suffix = &#8221;;<\/p>\n<p>            \/\/is WooCommerce installed and is current page shop page?<br \/>\n            if(kloe_qodef_is_woocommerce_installed() &amp;&amp; kloe_qodef_is_woocommerce_shop()) {<br \/>\n                \/\/get shop page id<br \/>\n                $id = kloe_qodef_get_woo_shop_page_id();<br \/>\n            }<\/p>\n<p>            \/\/is WP 4.1 at least?<br \/>\n            if(function_exists(&#8216;_wp_render_title_tag&#8217;)) {<br \/>\n                \/\/set unchanged title variable so we can use it later<br \/>\n                $title_array     = explode($sep, $title);<br \/>\n                $unchanged_title = array_shift($title_array);<br \/>\n            } \/\/pre 4.1 version of WP<br \/>\n            else {<br \/>\n                \/\/set unchanged title variable so we can use it later<br \/>\n                $unchanged_title = $title;<br \/>\n            }<br \/>\n            \/\/title suffix is empty, which means that it wasn&#8217;t set by qode seo<br \/>\n            if(empty($title_suffix)) {<br \/>\n                \/\/if current page is front page append site description, else take original title string<br \/>\n                $title_suffix = is_front_page() ? get_bloginfo(&#8216;description&#8217;) : $unchanged_title;<br \/>\n            }<\/p>\n<p>            \/\/concatenate title string<br \/>\n            $title = $title_prefix.$sep.$title_suffix;<\/p>\n<p>            \/\/return generated title string<br \/>\n            return $title;<br \/>\n        }<br \/>\n    }<\/p>\n<p>    add_filter(&#8216;wp_title&#8217;, &#8216;kloe_qodef_wp_title_text&#8217;, 10, 2);<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_wp_title&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that outputs title tag. It checks if _wp_render_title_tag function exists<br \/>\n     * and if it does&#8217;nt it generates output. Compatible with versions of WP prior to 4.1<br \/>\n     *\/<br \/>\n    function kloe_qodef_wp_title() {<br \/>\n        if(!function_exists(&#8216;_wp_render_title_tag&#8217;)) { ?&gt;<br \/>\n            &lt;title&gt;&lt;?php wp_title(&#8221;); ?&gt;&lt;\/title&gt;<br \/>\n        &lt;?php }<br \/>\n    }<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_header_meta&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that echoes meta data<br \/>\n     *\/<br \/>\n    function kloe_qodef_header_meta() { ?&gt;<\/p>\n<p>        &lt;meta charset=&#8221;&lt;?php bloginfo(&#8216;charset&#8217;); ?&gt;&#8221;\/&gt;<br \/>\n        &lt;link rel=&#8221;profile&#8221; href=&#8221;http:\/\/gmpg.org\/xfn\/11&#8243;\/&gt;<br \/>\n        &lt;link rel=&#8221;pingback&#8221; href=&#8221;&lt;?php bloginfo(&#8216;pingback_url&#8217;); ?&gt;&#8221;\/&gt;<\/p>\n<p>    &lt;?php }<\/p>\n<p>    add_action(&#8216;kloe_qodef_header_meta&#8217;, &#8216;kloe_qodef_header_meta&#8217;);<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_user_scalable_meta&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that outputs user scalable meta if responsiveness is turned on<br \/>\n     * Hooked to kloe_qodef_header_meta action<br \/>\n     *\/<br \/>\n    function kloe_qodef_user_scalable_meta() {<br \/>\n        \/\/is responsiveness option is chosen?<br \/>\n        if(kloe_qodef_is_responsive_on()) { ?&gt;<br \/>\n            &lt;meta name=&#8221;viewport&#8221; content=&#8221;width=device-width,initial-scale=1,user-scalable=no&#8221;&gt;<br \/>\n        &lt;?php } else { ?&gt;<br \/>\n            &lt;meta name=&#8221;viewport&#8221; content=&#8221;width=1200,user-scalable=no&#8221;&gt;<br \/>\n        &lt;?php }<br \/>\n    }<\/p>\n<p>    add_action(&#8216;kloe_qodef_header_meta&#8217;, &#8216;kloe_qodef_user_scalable_meta&#8217;);<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_get_page_id&#8217;)) {<br \/>\n\t\/**<br \/>\n\t * Function that returns current page \/ post id.<br \/>\n\t * Checks if current page is woocommerce page and returns that id if it is.<br \/>\n\t * Checks if current page is any archive page (category, tag, date, author etc.) and returns -1 because that isn&#8217;t<br \/>\n\t * page that is created in WP admin.<br \/>\n\t *<br \/>\n     * @param boolean if single product page is displayed<br \/>\n     *<br \/>\n\t * @return int<br \/>\n\t *<br \/>\n\t * @version 0.1<br \/>\n\t *<br \/>\n\t * @see kloe_qodef_is_woocommerce_installed()<br \/>\n\t * @see kloe_qodef_is_woocommerce_shop()<br \/>\n\t *\/<br \/>\n\tfunction kloe_qodef_get_page_id() {<br \/>\n\t\tif(kloe_qodef_is_woocommerce_installed() &amp;&amp; kloe_qodef_is_woocommerce_shop()) {<br \/>\n\t\t\treturn kloe_qodef_get_woo_shop_page_id();<br \/>\n\t\t}<\/p>\n<p>\t\tif(is_archive() || is_search() || is_404() || (is_home() &amp;&amp; is_front_page())) {<br \/>\n\t\t\treturn -1;<br \/>\n\t\t}<\/p>\n<p>\t\treturn get_queried_object_id();<br \/>\n\t}<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_is_default_wp_template&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that checks if current page archive page, search, 404 or default home blog page<br \/>\n     * @return bool<br \/>\n     *<br \/>\n     * @see is_archive()<br \/>\n     * @see is_search()<br \/>\n     * @see is_404()<br \/>\n     * @see is_front_page()<br \/>\n     * @see is_home()<br \/>\n     *\/<br \/>\n    function kloe_qodef_is_default_wp_template() {<br \/>\n        return is_archive() || is_search() || is_404() || (is_front_page() &amp;&amp; is_home());<br \/>\n    }<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_get_page_template_name&#8217;)) {<br \/>\n    \/**<br \/>\n     * Returns current template file name without extension<br \/>\n     * @return string name of current template file<br \/>\n     *\/<br \/>\n    function kloe_qodef_get_page_template_name() {<br \/>\n        $file_name = &#8221;;<\/p>\n<p>        if(!kloe_qodef_is_default_wp_template()) {<br \/>\n            $file_name_without_ext = preg_replace(&#8216;\/\\\\.[^.\\\\s]{3,4}$\/&#8217;, &#8221;, basename(get_page_template()));<\/p>\n<p>            if($file_name_without_ext !== &#8221;) {<br \/>\n                $file_name = $file_name_without_ext;<br \/>\n            }<br \/>\n        }<\/p>\n<p>        return $file_name;<br \/>\n    }<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_has_shortcode&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that checks whether shortcode exists on current page \/ post<br \/>\n     *<br \/>\n     * @param string shortcode to find<br \/>\n     * @param string content to check. If isn&#8217;t passed current post content will be used<br \/>\n     *<br \/>\n     * @return bool whether content has shortcode or not<br \/>\n     *\/<br \/>\n    function kloe_qodef_has_shortcode($shortcode, $content = &#8221;) {<br \/>\n        $has_shortcode = false;<\/p>\n<p>        if($shortcode) {<br \/>\n            \/\/if content variable isn&#8217;t past<br \/>\n            if($content == &#8221;) {<br \/>\n                \/\/take content from current post<br \/>\n                $page_id = kloe_qodef_get_page_id();<br \/>\n                if(!empty($page_id)) {<br \/>\n                    $current_post = get_post($page_id);<\/p>\n<p>                    if(is_object($current_post) &amp;&amp; property_exists($current_post, &#8216;post_content&#8217;)) {<br \/>\n                        $content = $current_post-&gt;post_content;<br \/>\n                    }<br \/>\n                }<br \/>\n            }<\/p>\n<p>            \/\/does content has shortcode added?<br \/>\n            if(stripos($content, &#8216;[&#8216;.$shortcode) !== false) {<br \/>\n                $has_shortcode = true;<br \/>\n            }<br \/>\n        }<\/p>\n<p>        return $has_shortcode;<br \/>\n    }<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_rewrite_rules_on_theme_activation&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that flushes rewrite rules on deactivation<br \/>\n     *\/<br \/>\n    function kloe_qodef_rewrite_rules_on_theme_activation() {<br \/>\n        flush_rewrite_rules();<br \/>\n    }<\/p>\n<p>    add_action(&#8216;after_switch_theme&#8217;, &#8216;kloe_qodef_rewrite_rules_on_theme_activation&#8217;);<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_get_dynamic_sidebar&#8217;)) {<br \/>\n    \/**<br \/>\n     * Return Custom Widget Area content<br \/>\n     *<br \/>\n     * @return string<br \/>\n     *\/<br \/>\n    function kloe_qodef_get_dynamic_sidebar($index = 1) {<br \/>\n        ob_start();<br \/>\n        dynamic_sidebar($index);<br \/>\n        $sidebar_contents = ob_get_clean();<\/p>\n<p>        return $sidebar_contents;<br \/>\n    }<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_get_sidebar&#8217;)) {<br \/>\n    \/**<br \/>\n     * Return Sidebar<br \/>\n     *<br \/>\n     * @return string<br \/>\n     *\/<br \/>\n    function kloe_qodef_get_sidebar() {<\/p>\n<p>        $id = kloe_qodef_get_page_id();<\/p>\n<p>        $sidebar = &#8220;sidebar&#8221;;<\/p>\n<p>        if (get_post_meta($id, &#8216;qodef_custom_sidebar_meta&#8217;, true) != &#8221;) {<br \/>\n            $sidebar = get_post_meta($id, &#8216;qodef_custom_sidebar_meta&#8217;, true);<br \/>\n        } else {<br \/>\n            if (is_single() &amp;&amp; kloe_qodef_options()-&gt;getOptionValue(&#8216;blog_single_custom_sidebar&#8217;) != &#8221;) {<br \/>\n                $sidebar = esc_attr(kloe_qodef_options()-&gt;getOptionValue(&#8216;blog_single_custom_sidebar&#8217;));<br \/>\n            }elseif((kloe_qodef_is_product_category() || kloe_qodef_is_product_tag()) &amp;&amp; kloe_qodef_get_woo_shop_page_id()) {<br \/>\n                $shop_id = kloe_qodef_get_woo_shop_page_id();<br \/>\n                if(get_post_meta($shop_id, &#8216;qodef_custom_sidebar_meta&#8217;, true) != &#8221;) {<br \/>\n                    $sidebar = esc_attr(get_post_meta($shop_id, &#8216;qodef_custom_sidebar_meta&#8217;, true));<br \/>\n                }<br \/>\n            }elseif ((is_archive() || (is_home() &amp;&amp; is_front_page())) &amp;&amp; kloe_qodef_options()-&gt;getOptionValue(&#8216;blog_custom_sidebar&#8217;) != &#8221;) {<br \/>\n                $sidebar = esc_attr(kloe_qodef_options()-&gt;getOptionValue(&#8216;blog_custom_sidebar&#8217;));<br \/>\n            }elseif (is_page() &amp;&amp; kloe_qodef_options()-&gt;getOptionValue(&#8216;page_custom_sidebar&#8217;) != &#8221;) {<br \/>\n                $sidebar = esc_attr(kloe_qodef_options()-&gt;getOptionValue(&#8216;page_custom_sidebar&#8217;));<br \/>\n            }<br \/>\n        }<\/p>\n<p>        return $sidebar;<br \/>\n    }<br \/>\n}<\/p>\n<p>if( !function_exists(&#8216;kloe_qodef_sidebar_columns_class&#8217;) ) {<\/p>\n<p>    \/**<br \/>\n     * Return classes for columns holder when sidebar is active<br \/>\n     *<br \/>\n     * @return array<br \/>\n     *\/<\/p>\n<p>    function kloe_qodef_sidebar_columns_class() {<\/p>\n<p>        $sidebar_class = array();<br \/>\n        $sidebar_layout = kloe_qodef_sidebar_layout();<\/p>\n<p>        switch($sidebar_layout):<br \/>\n            case &#8216;sidebar-33-right&#8217;:<br \/>\n                $sidebar_class[] = &#8216;qodef-two-columns-66-33&#8217;;<br \/>\n                break;<br \/>\n            case &#8216;sidebar-25-right&#8217;:<br \/>\n                $sidebar_class[] = &#8216;qodef-two-columns-75-25&#8217;;<br \/>\n                break;<br \/>\n            case &#8216;sidebar-33-left&#8217;:<br \/>\n                $sidebar_class[] = &#8216;qodef-two-columns-33-66&#8217;;<br \/>\n                break;<br \/>\n            case &#8216;sidebar-25-left&#8217;:<br \/>\n                $sidebar_class[] = &#8216;qodef-two-columns-25-75&#8217;;<br \/>\n                break;<\/p>\n<p>        endswitch;<\/p>\n<p>        $sidebar_class[] = &#8216;clearfix&#8217;;<\/p>\n<p>        return kloe_qodef_class_attribute($sidebar_class);<\/p>\n<p>    }<\/p>\n<p>}<\/p>\n<p>if( !function_exists(&#8216;kloe_qodef_sidebar_layout&#8217;) ) {<\/p>\n<p>    \/**<br \/>\n     * Function that check is sidebar is enabled and return type of sidebar layout<br \/>\n     *\/<\/p>\n<p>    function kloe_qodef_sidebar_layout() {<\/p>\n<p>        $sidebar_layout = &#8221;;<br \/>\n        $page_id        = kloe_qodef_get_page_id();<\/p>\n<p>        $page_sidebar_meta = get_post_meta($page_id, &#8216;qodef_sidebar_meta&#8217;, true);<\/p>\n<p>        if(($page_sidebar_meta !== &#8221;) &amp;&amp; $page_id !== -1) {<br \/>\n            if($page_sidebar_meta == &#8216;no-sidebar&#8217;) {<br \/>\n                $sidebar_layout = &#8221;;<br \/>\n            } else {<br \/>\n                $sidebar_layout = $page_sidebar_meta;<br \/>\n            }<br \/>\n        } else {<br \/>\n            if(is_single() &amp;&amp; kloe_qodef_options()-&gt;getOptionValue(&#8216;blog_single_sidebar_layout&#8217;)) {<br \/>\n                $sidebar_layout = esc_attr(kloe_qodef_options()-&gt;getOptionValue(&#8216;blog_single_sidebar_layout&#8217;));<br \/>\n            } elseif((is_archive() || (is_home() &amp;&amp; is_front_page())) &amp;&amp; kloe_qodef_options()-&gt;getOptionValue(&#8216;archive_sidebar_layout&#8217;)) {<br \/>\n                $sidebar_layout = esc_attr(kloe_qodef_options()-&gt;getOptionValue(&#8216;archive_sidebar_layout&#8217;));<br \/>\n            } elseif(is_page() &amp;&amp; kloe_qodef_options()-&gt;getOptionValue(&#8216;page_sidebar_layout&#8217;)) {<br \/>\n                $sidebar_layout = esc_attr(kloe_qodef_options()-&gt;getOptionValue(&#8216;page_sidebar_layout&#8217;));<br \/>\n            }<br \/>\n        }<\/p>\n<p>        return $sidebar_layout;<\/p>\n<p>    }<\/p>\n<p>}<\/p>\n<p>if( !function_exists(&#8216;kloe_qodef_page_custom_style&#8217;) ) {<\/p>\n<p>    \/**<br \/>\n     * Function that print custom page style<br \/>\n     *\/<\/p>\n<p>    function kloe_qodef_page_custom_style() {<br \/>\n       $html = &#8221;;<br \/>\n       $style = apply_filters(&#8216;kloe_qodef_add_page_custom_style&#8217;, $style = array());<br \/>\n        if($style !== &#8221;) {<br \/>\n            $html .= &#8216;&lt;style type=&#8221;text\/css&#8221;&gt;&#8217;;<br \/>\n            $html .= $style;<br \/>\n            $html .= &#8216;&lt;\/style&gt;&#8217;;<br \/>\n        }<br \/>\n        print $html;<br \/>\n    }<\/p>\n<p>   add_action(&#8216;wp_head&#8217;, &#8216;kloe_qodef_page_custom_style&#8217;);<br \/>\n}<\/p>\n<p>if( !function_exists(&#8216;kloe_qodef_register_page_custom_style&#8217;) ) {<\/p>\n<p>    \/**<br \/>\n     * Function that print custom page style<br \/>\n     *\/<\/p>\n<p>    function kloe_qodef_register_page_custom_style() {<br \/>\n        add_action( (kloe_qodef_is_ajax_enabled() &amp;&amp; kloe_qodef_is_ajax_request()) ? &#8216;kloe_qodef_ajax_meta&#8217; : &#8216;wp_head&#8217;, &#8216;kloe_qodef_page_custom_style&#8217; );<br \/>\n    }<\/p>\n<p>    add_action( &#8216;kloe_qodef_after_options_map&#8217;, &#8216;kloe_qodef_register_page_custom_style&#8217; );<br \/>\n}<\/p>\n<p>if( !function_exists(&#8216;kloe_qodef_vc_custom_style&#8217;) ) {<\/p>\n<p>    \/**<br \/>\n     * Function that print custom page style<br \/>\n     *\/<\/p>\n<p>    function kloe_qodef_vc_custom_style() {<br \/>\n        if(kloe_qodef_visual_composer_installed()) {<br \/>\n            $id = kloe_qodef_get_page_id();<br \/>\n            if(is_page() || is_single() || is_singular(&#8216;portfolio-item&#8217;)) {<\/p>\n<p>                $shortcodes_custom_css = get_post_meta( $id, &#8216;_wpb_shortcodes_custom_css&#8217;, true );<br \/>\n                if ( ! empty( $shortcodes_custom_css ) ) {<br \/>\n                    echo &#8216;&lt;style type=&#8221;text\/css&#8221; data-type=&#8221;vc_shortcodes-custom-css-&#8216;.esc_attr($id).'&#8221;&gt;&#8217;;<br \/>\n                    echo get_post_meta( $id, &#8216;_wpb_shortcodes_custom_css&#8217;, true );<br \/>\n                    echo &#8216;&lt;\/style&gt;&#8217;;<br \/>\n                }<\/p>\n<p>                $post_custom_css = get_post_meta( $id, &#8216;_wpb_post_custom_css&#8217;, true );<br \/>\n                if ( ! empty( $post_custom_css ) ) {<br \/>\n                    echo &#8216;&lt;style type=&#8221;text\/css&#8221; data-type=&#8221;vc_custom-css-&#8216;.esc_attr($id).'&#8221;&gt;&#8217;;<br \/>\n                    echo get_post_meta( $id, &#8216;_wpb_post_custom_css&#8217;, true );<br \/>\n                    echo &#8216;&lt;\/style&gt;&#8217;;<br \/>\n                }<br \/>\n            }<br \/>\n        }<br \/>\n    }<\/p>\n<p>}<\/p>\n<p>if( !function_exists(&#8216;kloe_qodef_register_vc_custom_style&#8217;) ) {<\/p>\n<p>    \/**<br \/>\n     * Function that print custom page style<br \/>\n     *\/<\/p>\n<p>    function kloe_qodef_register_vc_custom_style() {<br \/>\n        if (kloe_qodef_is_ajax_enabled() &amp;&amp; kloe_qodef_is_ajax_request()) {<br \/>\n            add_action( &#8216;kloe_qodef_ajax_meta&#8217;, &#8216;kloe_qodef_vc_custom_style&#8217; );<br \/>\n        }<\/p>\n<p>    }<\/p>\n<p>    add_action( &#8216;kloe_qodef_after_options_map&#8217;, &#8216;kloe_qodef_register_vc_custom_style&#8217; );<br \/>\n}<\/p>\n<p>if( !function_exists(&#8216;kloe_qodef_container_style&#8217;) ) {<\/p>\n<p>    \/**<br \/>\n     * Function that return container style<br \/>\n     *\/<\/p>\n<p>    function kloe_qodef_container_style($style) {<br \/>\n        $id = kloe_qodef_get_page_id();<br \/>\n        $class_prefix = kloe_qodef_get_unique_page_class();<\/p>\n<p>        $container_selector = array(<br \/>\n            $class_prefix.&#8217; .qodef-content .qodef-content-inner &gt; .qodef-container&#8217;,<br \/>\n            $class_prefix.&#8217; .qodef-content .qodef-content-inner &gt; .qodef-full-width&#8217;,<br \/>\n        );<\/p>\n<p>        $container_class = array();<br \/>\n        $page_backgorund_color = get_post_meta($id, &#8220;qodef_page_background_color_meta&#8221;, true);<\/p>\n<p>        if($page_backgorund_color){<br \/>\n            $container_class[&#8216;background-color&#8217;] = $page_backgorund_color;<br \/>\n        }<\/p>\n<p>        $current_style = kloe_qodef_dynamic_css($container_selector, $container_class);<br \/>\n        $style[] = $current_style;<\/p>\n<p>        return $current_style;<\/p>\n<p>    }<br \/>\n    add_filter(&#8216;kloe_qodef_add_page_custom_style&#8217;, &#8216;kloe_qodef_container_style&#8217;);<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_get_unique_page_class&#8217;)) {<br \/>\n    \/**<br \/>\n     * Returns unique page class based on post type and page id<br \/>\n     *<br \/>\n     * @return string<br \/>\n     *\/<br \/>\n    function kloe_qodef_get_unique_page_class() {<br \/>\n        $id = kloe_qodef_get_page_id();<br \/>\n        $page_class = &#8221;;<\/p>\n<p>        if(is_single()) {<br \/>\n            $page_class = &#8216;.postid-&#8216;.$id;<br \/>\n        } elseif($id === kloe_qodef_get_woo_shop_page_id()) {<br \/>\n            $page_class = &#8216;.archive&#8217;;<br \/>\n        } else {<br \/>\n            $page_class .= &#8216;.page-id-&#8216;.$id;<br \/>\n        }<\/p>\n<p>        return $page_class;<br \/>\n    }<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_print_custom_css&#8217;)) {<br \/>\n    \/**<br \/>\n     * Prints out custom css from theme options<br \/>\n     *\/<br \/>\n    function kloe_qodef_print_custom_css() {<br \/>\n        $custom_css = kloe_qodef_options()-&gt;getOptionValue(&#8216;custom_css&#8217;);<br \/>\n        $output = &#8221;;<\/p>\n<p>        if($custom_css !== &#8221;) {<br \/>\n            wp_add_inline_style( &#8216;kloe_qodef_modules&#8217;, $custom_css);<br \/>\n        }<\/p>\n<p>        print $output;<br \/>\n    }<\/p>\n<p>    add_action(&#8216;wp_enqueue_scripts&#8217;, &#8216;kloe_qodef_print_custom_css&#8217;);<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_print_custom_js&#8217;)) {<br \/>\n    \/**<br \/>\n     * Prints out custom css from theme options<br \/>\n     *\/<br \/>\n    function kloe_qodef_print_custom_js() {<br \/>\n        $custom_js = kloe_qodef_options()-&gt;getOptionValue(&#8216;custom_js&#8217;);<br \/>\n        $output = &#8221;;<\/p>\n<p>        if($custom_js !== &#8221;) {<br \/>\n            $output .= &#8216;&lt;script type=&#8221;text\/javascript&#8221; id=&#8221;kloe_qodef-custom-js&#8221;&gt;&#8217;;<br \/>\n            $output .= &#8216;(function($) {&#8216;;<br \/>\n            $output .= $custom_js;<br \/>\n            $output .= &#8216;})(jQuery)&#8217;;<br \/>\n            $output .= &#8216;&lt;\/script&gt;&#8217;;<br \/>\n        }<\/p>\n<p>        print $output;<br \/>\n    }<\/p>\n<p>    add_action(&#8216;wp_footer&#8217;, &#8216;kloe_qodef_print_custom_js&#8217;, 1000);<br \/>\n}<\/p>\n<p>if( !function_exists(&#8216;kloe_qodef_page_padding&#8217;) ) {<\/p>\n<p>    \/**<br \/>\n     * Function that return container style<br \/>\n     *\/<\/p>\n<p>    function kloe_qodef_page_padding( $style ) {<\/p>\n<p>        $id = kloe_qodef_get_page_id();<\/p>\n<p>        $page_selector = array(<br \/>\n            &#8216;.page-id-&#8216; . $id . &#8216; .qodef-content .qodef-content-inner &gt; .qodef-container &gt; .qodef-container-inner&#8217;,<br \/>\n            &#8216;.page-id-&#8216; . $id . &#8216; .qodef-content .qodef-content-inner &gt; .qodef-full-width &gt; .qodef-full-width-inner&#8217;<br \/>\n        );<br \/>\n        $page_css = array();<\/p>\n<p>        $page_padding = get_post_meta($id, &#8216;qodef_page_padding_meta&#8217;, true);<\/p>\n<p>        if($page_padding !== &#8221;){<br \/>\n            $page_css[&#8216;padding&#8217;] = $page_padding;<br \/>\n        }<\/p>\n<p>        $current_style = kloe_qodef_dynamic_css($page_selector, $page_css);<\/p>\n<p>        $current_style = $current_style . $style;<\/p>\n<p>        return $current_style;<\/p>\n<p>    }<br \/>\n    add_filter(&#8216;kloe_qodef_add_page_custom_style&#8217;, &#8216;kloe_qodef_page_padding&#8217;);<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_get_global_variables&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that generates global variables and put them in array so they could be used in the theme<br \/>\n     *\/<br \/>\n    function kloe_qodef_get_global_variables() {<\/p>\n<p>        $global_variables = array();<br \/>\n        $element_appear_amount = -80;<\/p>\n<p>        $global_variables[&#8216;qodefAddForAdminBar&#8217;] = is_admin_bar_showing() ? 32 : 0;<br \/>\n        $global_variables[&#8216;qodefElementAppearAmount&#8217;] = kloe_qodef_options()-&gt;getOptionValue(&#8216;element_appear_amount&#8217;) !== &#8221; ? kloe_qodef_options()-&gt;getOptionValue(&#8216;element_appear_amount&#8217;) : $element_appear_amount;<br \/>\n        $global_variables[&#8216;qodefFinishedMessage&#8217;] = esc_html__(&#8216;No more posts&#8217;, &#8216;kloe&#8217;);<br \/>\n        $global_variables[&#8216;qodefMessage&#8217;] = esc_html__(&#8216;Loading new posts&#8230;&#8217;, &#8216;kloe&#8217;);<\/p>\n<p>        $global_variables = apply_filters(&#8216;kloe_qodef_js_global_variables&#8217;, $global_variables);<\/p>\n<p>        wp_localize_script(&#8216;kloe_qodef_modules&#8217;, &#8216;qodefGlobalVars&#8217;, array(<br \/>\n            &#8216;vars&#8217; =&gt; $global_variables<br \/>\n        ));<\/p>\n<p>    }<\/p>\n<p>    add_action(&#8216;wp_enqueue_scripts&#8217;, &#8216;kloe_qodef_get_global_variables&#8217;);<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_per_page_js_variables&#8217;)) {<br \/>\n    function kloe_qodef_per_page_js_variables() {<br \/>\n        $per_page_js_vars = apply_filters(&#8216;kloe_qodef_per_page_js_vars&#8217;, array());<\/p>\n<p>        wp_localize_script(&#8216;kloe_qodef_modules&#8217;, &#8216;qodefPerPageVars&#8217;, array(<br \/>\n            &#8216;vars&#8217; =&gt; $per_page_js_vars<br \/>\n        ));<br \/>\n    }<\/p>\n<p>    add_action(&#8216;wp_enqueue_scripts&#8217;, &#8216;kloe_qodef_per_page_js_variables&#8217;);<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_content_elem_style_attr&#8217;)) {<br \/>\n    \/**<br \/>\n     * Defines filter for adding custom styles to content HTML element<br \/>\n     *\/<br \/>\n    function kloe_qodef_content_elem_style_attr() {<br \/>\n        $styles = apply_filters(&#8216;kloe_qodef_content_elem_style_attr&#8217;, array());<\/p>\n<p>        kloe_qodef_inline_style($styles);<br \/>\n    }<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_is_woocommerce_installed&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that checks if woocommerce is installed<br \/>\n     * @return bool<br \/>\n     *\/<br \/>\n    function kloe_qodef_is_woocommerce_installed() {<br \/>\n        return function_exists(&#8216;is_woocommerce&#8217;);<br \/>\n    }<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_visual_composer_installed&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that checks if visual composer installed<br \/>\n     * @return bool<br \/>\n     *\/<br \/>\n    function kloe_qodef_visual_composer_installed() {<br \/>\n        \/\/is Visual Composer installed?<br \/>\n        if(class_exists(&#8216;WPBakeryVisualComposerAbstract&#8217;)) {<br \/>\n            return true;<br \/>\n        }<\/p>\n<p>        return false;<br \/>\n    }<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_seo_plugin_installed&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that checks if popular seo plugins are installed<br \/>\n     * @return bool<br \/>\n     *\/<br \/>\n    function kloe_qodef_seo_plugin_installed() {<br \/>\n        \/\/is &#8216;YOAST&#8217; or &#8216;All in One SEO&#8217; installed?<br \/>\n        if(defined(&#8216;WPSEO_VERSION&#8217;) || class_exists(&#8216;All_in_One_SEO_Pack&#8217;)) {<br \/>\n            return true;<br \/>\n        }<\/p>\n<p>        return false;<br \/>\n    }<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_contact_form_7_installed&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that checks if contact form 7 installed<br \/>\n     * @return bool<br \/>\n     *\/<br \/>\n    function kloe_qodef_contact_form_7_installed() {<br \/>\n        \/\/is Contact Form 7 installed?<br \/>\n        if(defined(&#8216;WPCF7_VERSION&#8217;)) {<br \/>\n            return true;<br \/>\n        }<\/p>\n<p>        return false;<br \/>\n    }<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_is_wpml_installed&#8217;)) {<br \/>\n    \/**<br \/>\n     * Function that checks if WPML plugin is installed<br \/>\n     * @return bool<br \/>\n     *<br \/>\n     * @version 0.1<br \/>\n     *\/<br \/>\n    function kloe_qodef_is_wpml_installed() {<br \/>\n        return defined(&#8216;ICL_SITEPRESS_VERSION&#8217;);<br \/>\n    }<br \/>\n}<\/p>\n<p>if(!function_exists(&#8216;kloe_qodef_max_image_width_srcset&#8217;)) {<br \/>\n    \/**<br \/>\n     * Set max width for srcset to 1920<br \/>\n     *<br \/>\n     * @return int<br \/>\n     *\/<br \/>\n    function kloe_qodef_max_image_width_srcset() {<br \/>\n        return 1920;<br \/>\n    }<\/p>\n<p>    add_filter(&#8216;max_srcset_image_width&#8217;, &#8216;kloe_qodef_max_image_width_srcset&#8217;);<br \/>\n}<\/p>\n<p>if ( ! function_exists( &#8216;kloe_qodef_is_gutenberg_installed&#8217; ) ) {<br \/>\n\t\/**<br \/>\n\t * Function that checks if Gutenberg plugin installed<br \/>\n\t * @return bool<br \/>\n\t *\/<br \/>\n\tfunction kloe_qodef_is_gutenberg_installed() {<br \/>\n\t\treturn function_exists( &#8216;is_gutenberg_page&#8217; ) &amp;&amp; is_gutenberg_page();<br \/>\n\t}<br \/>\n}<\/p>\n<p>add_filter( &#8216;woocommerce_get_image_size_gallery_thumbnail&#8217;, function( $size ) {<br \/>\n    return array(<br \/>\n        &#8216;width&#8217;  =&gt; 600,<br \/>\n        &#8216;height&#8217; =&gt; 600,<br \/>\n        &#8216;crop&#8217;   =&gt; 1,<br \/>\n    );<br \/>\n } );<\/p>\n<p> add_theme_support( &#8216;woocommerce&#8217;, array(<br \/>\n    &#8216;gallery_thumbnail_image_width&#8217; =&gt; 600,<br \/>\n ) );<\/p>\n<p>function my_wc_hide_in_stock_message( $html, $text, $product ) {<br \/>\n\t$availability = $product-&gt;get_availability();<br \/>\n\tif ( isset( $availability[&#8216;class&#8217;] ) &amp;&amp; &#8216;in-stock&#8217; === $availability[&#8216;class&#8217;] ) {<br \/>\n\t\treturn &#8221;;<br \/>\n\t}<br \/>\n\treturn $html;<br \/>\n}<br \/>\nadd_filter( &#8216;woocommerce_stock_html&#8217;, &#8216;my_wc_hide_in_stock_message&#8217;, 10, 3 );<\/p>\n<p><\/em><\/p>\n","protected":false},"template":"","class_list":["post-12072134","topic","type-topic","status-publish","hentry","topic-tag-function-php"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12072134","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12072134\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=12072134"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}