/** * Prints the box content * @package Customizr * @since Customizr 1.0 */ function tc_post_layout_box($post) { // Use nonce for verification wp_nonce_field(plugin_basename(__FILE__), 'post_layout_noncename'); // The actual fields for data entry // Use get_post_meta to retrieve an existing value from the database and use the value for the form //Layout name setup $layout_id = 'layout_field'; $layout_value = esc_attr(get_post_meta($post->ID, $key = 'layout_key', $single = true)); //Layouts select list array $layouts = array('r' => __('Right sidebar', 'customizr'), 'l' => __('Left sidebar', 'customizr'), 'b' => __('Two sidebars', 'customizr'), 'f' => __('Full Width', 'customizr')); //by default we apply the global default layout $tc_sidebar_default_layout = esc_attr(tc_get_options('tc_sidebar_global_layout')); if ($post->post_type == 'post') { $tc_sidebar_default_layout = esc_attr(tc_get_options('tc_sidebar_post_layout')); } if ($post->post_type == 'page') { $tc_sidebar_default_layout = esc_attr(tc_get_options('tc_sidebar_page_layout')); } //check if the 'force default layout' option is checked $force_layout = esc_attr(tc_get_options('tc_sidebar_force_layout')); ?> <div class="meta-box-item-content"> <?php if ($layout_value == null) { ?> <p><?php printf(__('Default %1$s layout is set to : %2$s', 'customizr'), $post->post_type == 'page' ? __('pages', 'customizr') : __('posts', 'customizr'), '<strong>' . $layouts[$tc_sidebar_default_layout] . '</strong>'); ?> </p> <?php } ?> <?php if ($force_layout == 1) { ?> <div style="width:99%; padding: 5px;"> <p><i><?php _e('You have checked the <i>"Force global default layout for all posts and pages"</i>, you must unchecked this option to enable a specific layout for this post.', 'customizr'); ?> </i></p> <p><a class="button-primary" href="<?php echo admin_url('customize.php'); ?> " target="_blank"><?php _e('Change layout options', 'customizr'); ?> </a></p> </div> <?php } else { ?> <i><?php printf(__('You can define a specific layout for %1$s by using the pre-defined left and right sidebars. The default layouts can be defined in the WordPress customizer screen %2$s.<br />', 'customizr'), $post->post_type == 'page' ? __('this page', 'customizr') : __('this post', 'customizr'), '<a href="' . admin_url('customize.php') . '" target="_blank">' . __('here', 'customizr') . '</a>'); ?> </i> <h4><?php printf(__('Select a specific layout for %1$s', 'customizr'), $post->post_type == 'page' ? __('this page', 'customizr') : __('this post', 'customizr')); ?> </h4> <select name="<?php echo $layout_id; ?> " id="<?php echo $layout_id; ?> "> <?php //no layout selected ?> <option value="" <?php selected($layout_value, $current = null, $echo = true); ?> > <?php printf(__('Default layout %1s', 'customizr'), '(' . $layouts[$tc_sidebar_default_layout] . ')'); ?> </option> <?php foreach ($layouts as $key => $l) { ?> <option value="<?php echo $key; ?> " <?php selected($layout_value, $current = $key, $echo = true); ?> ><?php echo $l; ?> </option> <?php } ?> </select> <?php } ?> </div> <?php }
function tc_fancybox($content) { $tc_fancybox = esc_attr(tc_get_options('tc_fancybox')); if ($tc_fancybox == 1) { global $post; $pattern = "/<a(.*?)href=('|\")(.*?).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>/i"; $replacement = '<a$1href=$2$3.$4$5 class="grouped_elements" rel="tc-fancybox-group' . $post->ID . '" title="' . $post->post_title . '"$6>'; $content = preg_replace($pattern, $replacement, $content); } return $content; }
/** * Customize the customizer : add settings and controls * @package Customizr * @since Customizr 1.0 */ function tc_customize_register($wp_customize) { //Remove unecessary defaults controls, settings and sections $wp_customize->remove_section('background_image'); $wp_customize->remove_section('static_front_page'); $wp_customize->remove_section('colors'); //$wp_customize-> remove_settings(); $wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogdescription')->transport = 'postMessage'; //Add button to Navigation Section $wp_customize->add_setting('menu_button', array('capability' => 'manage_options')); $wp_customize->add_control(new TC_Controls($wp_customize, 'menu_button', array('section' => 'nav', 'tc' => 'button', 'link' => 'nav-menus.php', 'buttontext' => __('Manage menus', 'customizr')))); //SKINS $wp_customize->add_section('tc_skins_settings', array('title' => __('Skin', 'customizr'), 'priority' => 10, 'description' => __('Select a skin for Customizr', 'customizr'))); //skin select $wp_customize->add_setting('tc_theme_options[tc_skin]', array('default' => 'blue.css', 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control('tc_theme_options[tc_skin]', array('label' => __('Choose a predefined skin', 'customizr'), 'section' => 'tc_skins_settings', 'type' => 'select', 'choices' => array('blue.css' => __('Blue', 'customizr'), 'green.css' => __('Green', 'customizr'), 'yellow.css' => __('Yellow', 'customizr'), 'orange.css' => __('Orange', 'customizr'), 'red.css' => __('Red', 'customizr'), 'purple.css' => __('Purple', 'customizr'), 'grey.css' => __('Grey', 'customizr'), 'black.css' => __('Black', 'customizr')))); //enable/disable top border $wp_customize->add_setting('tc_theme_options[tc_top_border]', array('default' => 1, 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control(new TC_Controls($wp_customize, 'tc_theme_options[tc_top_border]', array('settings' => 'tc_theme_options[tc_top_border]', 'label' => __('Display top border', 'customizr'), 'section' => 'tc_skins_settings', 'tc' => 'checkbox', 'notice' => __('Uncheck this option to remove the colored top border.', 'customizr')))); //LOGO & Favicon $wp_customize->add_section('tc_logo_settings', array('title' => __('Logo & Favicon', 'customizr'), 'priority' => 20, 'description' => __('Set up logo and favicon options', 'customizr'))); //logo $wp_customize->add_setting('tc_theme_options[tc_logo_upload]', array('capability' => 'edit_theme_options', 'type' => 'option')); $wp_customize->add_control(new WP_Customize_Upload_Control($wp_customize, 'tc_logo_upload', array('label' => __('Logo Upload', 'customizr'), 'section' => 'tc_logo_settings', 'settings' => 'tc_theme_options[tc_logo_upload]'))); //force logo resize 250 * 85 $wp_customize->add_setting('tc_theme_options[tc_logo_resize]', array('default' => 1, 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control('tc_theme_options[tc_logo_resize]', array('settings' => 'tc_theme_options[tc_logo_resize]', 'label' => __('Force logo dimensions to max-width:250px and max-height:100px', 'customizr'), 'section' => 'tc_logo_settings', 'type' => 'checkbox')); //hr $wp_customize->add_setting('hr_logo', array('capability' => 'manage_options')); $wp_customize->add_control(new TC_Controls($wp_customize, 'hr_logo', array('section' => 'tc_logo_settings', 'tc' => 'hr'))); //favicon $wp_customize->add_setting('tc_theme_options[tc_fav_upload]', array('capability' => 'edit_theme_options', 'type' => 'option')); $wp_customize->add_control(new WP_Customize_Upload_Control($wp_customize, 'tc_fav_upload', array('label' => __('Favicon Upload', 'customizr'), 'section' => 'tc_logo_settings', 'settings' => 'tc_theme_options[tc_fav_upload]'))); //$WP_Customize_Image_Control -> remove_tab('uploaded'); // FRONT PAGE SETTINGS // $wp_customize->add_section('tc_frontpage_settings', array('title' => __('Front Page', 'customizr'), 'priority' => 30, 'description' => __('Set up front page options', 'customizr'))); //title $wp_customize->add_setting('homecontent_title', array('capability' => 'manage_options')); $wp_customize->add_control(new TC_Controls($wp_customize, 'homecontent_title', array('title' => __('Choose content and layout', 'customizr'), 'section' => 'tc_frontpage_settings', 'tc' => 'title', 'priority' => 0))); $wp_customize->add_setting('show_on_front', array('default' => get_option('show_on_front'), 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control('show_on_front', array('label' => __('Front page displays', 'customizr'), 'section' => 'tc_frontpage_settings', 'type' => 'select', 'priority' => 1, 'choices' => array('posts' => __('Your latest posts', 'customizr'), 'page' => __('A static page', 'customizr')))); $wp_customize->add_setting('page_on_front', array('type' => 'option', 'capability' => 'manage_options')); $wp_customize->add_control('page_on_front', array('label' => __('Front page', 'customizr'), 'section' => 'tc_frontpage_settings', 'type' => 'dropdown-pages', 'priority' => 1)); $wp_customize->add_setting('page_for_posts', array('type' => 'option', 'capability' => 'manage_options')); $wp_customize->add_control('page_for_posts', array('label' => __('Posts page', 'customizr'), 'section' => 'tc_frontpage_settings', 'type' => 'dropdown-pages', 'priority' => 1)); //Layout $wp_customize->add_setting('tc_theme_options[tc_front_layout]', array('default' => 'f', 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control('tc_theme_options[tc_front_layout]', array('label' => __('Set up the front page layout', 'customizr'), 'section' => 'tc_frontpage_settings', 'type' => 'select', 'choices' => array('r' => __('Right sidebar', 'customizr'), 'l' => __('Left sidebar', 'customizr'), 'b' => __('2 sidebars : Right and Left', 'customizr'), 'f' => __('No sidebars : full width layout', 'customizr')), 'priority' => 2)); //Slider //retrieve slider names and generate the select list $slider_names = tc_get_options('tc_sliders'); $choices = array(0 => __('— No slider —', 'customizr'), 'demo' => __('— Demo Slider —', 'customizr')); if ($slider_names) { foreach ($slider_names as $tc_name => $slides) { $choices[$tc_name] = $tc_name; } } //select slider $wp_customize->add_setting('tc_theme_options[tc_front_slider]', array('default' => 'demo', 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control(new TC_Controls($wp_customize, 'tc_theme_options[tc_front_slider]', array('title' => __('Slider options', 'customizr'), 'label' => __('Select front page slider', 'customizr'), 'section' => 'tc_frontpage_settings', 'tc' => 'select', 'choices' => $choices, 'priority' => 20))); //Slider width checkbox $wp_customize->add_setting('tc_theme_options[tc_slider_width]', array('default' => 1, 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control(new TC_Controls($wp_customize, 'tc_theme_options[tc_slider_width]', array('settings' => 'tc_theme_options[tc_slider_width]', 'label' => __('Full width slider', 'customizr'), 'section' => 'tc_frontpage_settings', 'tc' => 'checkbox', 'priority' => 30))); //Slider Check message $wp_customize->add_setting('slider_check', array('capability' => 'manage_options')); $wp_customize->add_control(new TC_Controls($wp_customize, 'slider_check', array('section' => 'tc_frontpage_settings', 'tc' => 'slider-check', 'priority' => 40))); //Delay between each slides $wp_customize->add_setting('tc_theme_options[tc_slider_delay]', array('default' => 5000, 'type' => 'option', 'capability' => 'manage_options', 'sanitize_callback' => 'tc_sanitize_number')); $wp_customize->add_control(new TC_Controls($wp_customize, 'tc_theme_options[tc_slider_delay]', array('label' => __('Delay between each slides', 'customizr'), 'section' => 'tc_frontpage_settings', 'tc' => 'number', 'step' => 500, 'min' => 1000, 'notice' => __('in ms : 1000ms = 1s', 'customizr'), 'priority' => 50))); //Front page widget area $wp_customize->add_setting('tc_theme_options[tc_show_featured_pages]', array('default' => 1, 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control(new TC_Controls($wp_customize, 'tc_theme_options[tc_show_featured_pages]', array('title' => __('Featured pages options', 'customizr'), 'label' => __('Display home featured pages area', 'customizr'), 'section' => 'tc_frontpage_settings', 'tc' => 'select', 'choices' => array(1 => __('Enable', 'customizr'), 0 => __('Disable', 'customizr')), 'priority' => 50))); //display featured page images $wp_customize->add_setting('tc_theme_options[tc_show_featured_pages_img]', array('default' => 1, 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control(new TC_Controls($wp_customize, 'tc_theme_options[tc_show_featured_pages_img]', array('settings' => 'tc_theme_options[tc_show_featured_pages_img]', 'label' => __('Show images', 'customizr'), 'section' => 'tc_frontpage_settings', 'tc' => 'checkbox', 'notice' => __('The images are set with the "featured image" of each pages (in the page edit screen). Uncheck the option above to disable the featured page images.', 'customizr'), 'priority' => 60))); //WIDGETS //Home featured page generator $front_widget_areas = array('one' => __('one', 'customizr'), 'two' => __('two', 'customizr'), 'three' => __('three', 'customizr')); //priority index $priority = 60; //widget page foreach ($front_widget_areas as $key => $area) { $wp_customize->add_setting('tc_theme_options[tc_featured_page_' . $key . ']', array('capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control('tc_theme_options[tc_featured_page_' . $key . ']', array('label' => sprintf(__('Home featured page %s', 'customizr'), $area), 'section' => 'tc_frontpage_settings', 'type' => 'dropdown-pages', 'priority' => $priority)); $priority = $priority + 10; } //priority index $priority = 100; //widget text foreach ($front_widget_areas as $key => $area) { $wp_customize->add_setting('tc_theme_options[tc_featured_text_' . $key . ']', array('capability' => 'manage_options', 'type' => 'option', 'sanitize_callback' => 'tc_sanitize_textarea')); $wp_customize->add_control(new TC_Controls($wp_customize, 'tc_theme_options[tc_featured_text_' . $key . ']', array('settings' => 'tc_theme_options[tc_featured_text_' . $key . ']', 'label' => sprintf(__('Featured text %s (200 car. max)', 'customizr'), $area), 'section' => 'tc_frontpage_settings', 'tc' => 'textarea', 'notice' => __('Leave this field empty if you want to use the selected page excerpt.', 'customizr'), 'priority' => $priority))); $priority = $priority + 10; } // SITE LAYOUT // $wp_customize->add_section('tc_layout_settings', array('title' => __('Pages & Posts Layout', 'customizr'), 'priority' => 150, 'description' => __('Set up layout options', 'customizr'))); //Breadcrumb $wp_customize->add_setting('tc_theme_options[tc_breadcrumb]', array('default' => 1, 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control('tc_theme_options[tc_breadcrumb]', array('settings' => 'tc_theme_options[tc_breadcrumb]', 'label' => __('Display Breadcrumb', 'customizr'), 'section' => 'tc_layout_settings', 'type' => 'checkbox', 'priority' => 1)); //Global sidebar layout $wp_customize->add_setting('tc_theme_options[tc_sidebar_global_layout]', array('default' => 'l', 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control('tc_theme_options[tc_sidebar_global_layout]', array('settings' => 'tc_theme_options[tc_sidebar_global_layout]', 'label' => __('Choose the global default layout', 'customizr'), 'section' => 'tc_layout_settings', 'type' => 'select', 'choices' => array('r' => __('Right sidebar', 'customizr'), 'l' => __('Left sidebar', 'customizr'), 'b' => __('2 sidebars : Right and Left', 'customizr'), 'f' => __('No sidebars : full width layout', 'customizr')), 'priority' => 2)); //force default layout on every posts $wp_customize->add_setting('tc_theme_options[tc_sidebar_force_layout]', array('default' => 0, 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control(new TC_Controls($wp_customize, 'tc_theme_options[tc_sidebar_force_layout]', array('settings' => 'tc_theme_options[tc_sidebar_force_layout]', 'label' => __('Force default layout everywhere', 'customizr'), 'section' => 'tc_layout_settings', 'tc' => 'checkbox', 'notice' => __('This option will override the specific layouts on all posts/pages, including the front page.', 'customizr'), 'priority' => 3))); //Post sidebar layout $wp_customize->add_setting('tc_theme_options[tc_sidebar_post_layout]', array('default' => 'l', 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control('tc_theme_options[tc_sidebar_post_layout]', array('label' => __('Choose the posts default layout', 'customizr'), 'section' => 'tc_layout_settings', 'type' => 'select', 'choices' => array('r' => __('Right sidebar', 'customizr'), 'l' => __('Left sidebar', 'customizr'), 'b' => __('2 sidebars : Right and Left', 'customizr'), 'f' => __('No sidebars : full width layout', 'customizr')), 'priority' => 4)); //Post per page $wp_customize->add_setting('posts_per_page', array('default' => get_option('posts_per_page'), 'type' => 'option', 'capability' => 'manage_options', 'sanitize_callback' => 'tc_sanitize_number')); $wp_customize->add_control(new TC_Controls($wp_customize, 'posts_per_page', array('label' => __('Maximum number of posts per page', 'customizr'), 'section' => 'tc_layout_settings', 'tc' => 'number', 'step' => 1, 'min' => 1))); //Page sidebar layout $wp_customize->add_setting('tc_theme_options[tc_sidebar_page_layout]', array('default' => 'l', 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control('tc_theme_options[tc_sidebar_page_layout]', array('label' => __('Choose the pages default layout', 'customizr'), 'section' => 'tc_layout_settings', 'type' => 'select', 'choices' => array('r' => __('Right sidebar', 'customizr'), 'l' => __('Left sidebar', 'customizr'), 'b' => __('2 sidebars : Right and Left', 'customizr'), 'f' => __('No sidebars : full width layout', 'customizr')))); // COMMENTS SETTINGS // $wp_customize->add_section('tc_page_comments', array('title' => __('Comments', 'customizr'), 'priority' => 170, 'description' => __('Set up comments options', 'customizr'))); $wp_customize->add_setting('tc_theme_options[tc_page_comments]', array('default' => 0, 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control(new TC_Controls($wp_customize, 'tc_theme_options[tc_page_comments]', array('settings' => 'tc_theme_options[tc_page_comments]', 'label' => __('Enable comments on pages', 'customizr'), 'section' => 'tc_page_comments', 'tc' => 'checkbox', 'notice' => __('This option will enable comments on pages. You can disable comments for a single page in the quick edit mode of the page list screen.', 'customizr')))); // SOCIAL LINKS // $wp_customize->add_section('tc_social_settings', array('title' => __('Social links', 'customizr'), 'priority' => 200, 'description' => __('Set up your social links', 'customizr'))); //Position checkboxes $social_pos = array('header' => __('header', 'customizr'), 'right-sidebar' => __('right-sidebar', 'customizr'), 'left-sidebar' => __('left-sidebar', 'customizr'), 'footer' => __('footer', 'customizr')); //field generator foreach ($social_pos as $key => $pos) { $pos_option_name = 'tc_social_in_' . $key; $wp_customize->add_setting('tc_theme_options[' . $pos_option_name . ']', array('default' => tc_get_options($pos_option_name), 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control('tc_theme_options[' . $pos_option_name . ']', array('settings' => 'tc_theme_options[' . $pos_option_name . ']', 'label' => sprintf(__('Social links in %s', 'customizr'), $pos), 'priority' => 0, 'section' => 'tc_social_settings', 'type' => 'checkbox')); } //Social Url fields //define the option name => label array $socials = array('tc_rss' => __('RSS feed (default is the wordpress feed)', 'customizr'), 'tc_twitter' => __('Twitter profile url', 'customizr'), 'tc_facebook' => __('Facebook profile url', 'customizr'), 'tc_google' => __('Google+ profile url', 'customizr'), 'tc_youtube' => __('Youtube profile url', 'customizr'), 'tc_pinterest' => __('Pinterest profile url', 'customizr'), 'tc_github' => __('Github profile url', 'customizr'), 'tc_dribbble' => __('Dribbble profile url', 'customizr'), 'tc_linkedin' => __('LinkedIn profile url', 'customizr')); //Social fields generator with url sanitization foreach ($socials as $key => $nw) { $nw_option_name = 'tc_theme_options[' . $key . ']'; $wp_customize->add_setting($nw_option_name, array('default' => $key == 'tc_rss' ? get_bloginfo('rss_url') : tc_get_options($key), 'capability' => 'manage_options', 'type' => 'option', 'sanitize_callback' => 'tc_sanitize_url')); $wp_customize->add_control(new TC_Controls($wp_customize, $nw_option_name, array('settings' => $nw_option_name, 'label' => $nw, 'section' => 'tc_social_settings', 'tc' => 'url'))); } // IMAGE SETTINGS // $wp_customize->add_section('tc_image_settings', array('title' => __('Images', 'customizr'), 'priority' => 210, 'description' => __('Enable/disable lightbox effect on images', 'customizr'))); $wp_customize->add_setting('tc_theme_options[tc_fancybox]', array('default' => 1, 'capability' => 'manage_options', 'type' => 'option')); $wp_customize->add_control(new TC_Controls($wp_customize, 'tc_theme_options[tc_fancybox]', array('settings' => 'tc_theme_options[tc_fancybox]', 'label' => __('Enable/disable lightbox effect on images'), 'section' => 'tc_image_settings', 'tc' => 'checkbox', 'notice' => __('If enabled, this option activate a popin window whith a zoom effect when an image is clicked. This will not apply to image gallery.', 'customizr')))); // CUSTOM CSS // $wp_customize->add_section('tc_custom_css', array('title' => __('Custom CSS', 'customizr'), 'priority' => 220, 'description' => __('Add your own CSS', 'customizr'))); $wp_customize->add_setting('tc_theme_options[tc_custom_css]', array('capability' => 'manage_options', 'type' => 'option', 'sanitize_callback' => 'tc_sanitize_textarea')); $wp_customize->add_control(new TC_Controls($wp_customize, 'tc_theme_options[tc_custom_css]', array('settings' => 'tc_theme_options[tc_custom_css]', 'label' => __('Add your custom css here and design live! (for advanced users)', 'customizr'), 'section' => 'tc_custom_css', 'tc' => 'textarea', 'notice' => __('Always use this field to add your custom css instead of editing directly the style.css file : it will not be deleted during theme updates. Special characters like quotes or inferior/superior signs will not be accepted in this field as they might be used for malicious purposes. If your custom css includes some of these characters, just create a child theme and write it down in the style.css file.', 'customizr')))); }
* tag of your theme, or you will break many plugins, which * generally use this hook to add elements to <head> such * as styles, scripts, and meta tags. */ wp_head(); ?> </head> <body <?php body_class(); ?> itemscope itemtype="http://schema.org/WebPage"> <header class="tc-header clearfix" role="banner"> <?php $logo_src = esc_url(tc_get_options('tc_logo_upload')); $logo_resize = esc_attr(tc_get_options('tc_logo_resize')); ?> <div class="navbar-wrapper clearfix row-fluid"> <!-- Wrap the .navbar in .container to center it within the absolutely positioned parent. --> <?php if ($logo_src != null) { ?> <div class="brand span3"> <?php //logo styling option $logo_img_style = ''; if ($logo_resize == 1) { $logo_img_style = 'style="max-width:250px;max-height:100px"'; } ?> <h1><a class="site-logo" href="<?php
/** * Add a the slider options script in wp_footer() * @package Customizr * @since Customizr 1.0 * **/ function tc_slider_footer_options() { //get slider options if any $name_value = get_post_meta(get_the_ID(), $key = 'post_slider_key', $single = true); $delay_value = get_post_meta(get_the_ID(), $key = 'slider_delay_key', $single = true); //get the slider id and delay if we display home/front page if (is_front_page() || is_home()) { $name_value = tc_get_options('tc_front_slider'); $delay_value = tc_get_options('tc_slider_delay'); } //render the delay script if (!empty($delay_value)) { $delay = '{interval:' . $delay_value . '}'; } else { $delay = ''; } //fire the slider with the optionnal delay parameter if ($name_value != null) { //check if a slider is defined ?> <script type="text/javascript"> !function ($) { jQuery(function(){ // slider init $('#customizr-slider').carousel(<?php echo $delay; ?> ) }) }(window.jQuery) </script> <?php } //end if slider defined }