/** * Outputs the slider width styling */ function the_slider_width($echo = true) { $size = FA_style_size(); if ($echo) { echo $size['x']; } else { return $size['x']; } }
/** * Function for manually placing slideshows in theme pages. * It doesn't check current page so if you want to manually place a slideshow * directly in your theme, all page verifications must be done by you. This means * that if this function is called in header.php template, it will display on every * page of your blog. * * Usage in themes: * <?php * if( function_exists('FA_display_slider') ){ * FA_display_slider( $slider_id ); * } * ?> */ function FA_display_slider($slider_id, $echo = true) { $slider = get_post($slider_id); // if not set, bail out if (!$slider || 'fa_slider' != $slider->post_type) { return; } // set global options for the current slider FA_set_slider_options($slider_id); /* theme to be displayed as set in options */ $theme = FA_get_option(array('_fa_lite_theme', 'active_theme')); $theme_color = FA_get_option(array('_fa_lite_theme', 'active_theme_color')); /** * This is for backwards compatibility. * Prior to V2.4, theme Classic was actually 2 different themes: Light and Dark. * If slideshow was set on either dark or lite theme, those themes should no longer exist. * If user saved them, we'll use them. If not, switch to classic. */ $load_classic = FA_should_load_classic($theme); if ($load_classic) { $theme = $load_classic['active_theme']; $theme_color = $load_classic['active_theme_color']; } // selected theme path and url $theme_path = FA_theme_path($theme); $theme_url = FA_theme_url($theme); // check if theme exists if (!$theme_path) { return; // bail out if not } // display file path $theme_display = $theme_path . '/display.php'; // enqueue theme stylesheet $stylesheet_handler = 'FA_Lite_' . $theme; wp_enqueue_style($stylesheet_handler, $theme_url . '/stylesheet.css'); // let's see if colors is on if (!empty($theme_color)) { $color_style_handler = $stylesheet_handler . '-' . $theme_color; $color_style_url = $theme_url . '/colors/' . $theme_color; wp_enqueue_style($color_style_handler, $color_style_url, array($stylesheet_handler)); } // check for starter script or load the default one $custom_starter = $theme_path . '/starter.js'; if (is_file($custom_starter)) { wp_enqueue_script('FA_starter-' . $theme, $theme_url . '/starter.js', array('jquery')); } else { wp_enqueue_script('FA_general_starter', FA_path('scripts/script-loader.js'), array('jquery')); } global $post, $id, $FA_SLIDERS_PARAMS; // get js options for this slider and add them to global FA_SLIDERS_PARAMS that gets printed as footer script $js_options = FA_get_option('_fa_lite_js'); $js_options['protocol'] = is_ssl() ? 'https://' : 'http://'; $plugin_options = FA_plugin_options(); $js_options['no_credits'] = $plugin_options['disable_credits']; $js_options['img'] = FA_path('styles/images/fa_lite_ico.png'); $FA_SLIDERS_PARAMS['FA_slider_' . $slider_id] = FA_lite_json($js_options); // get the contents of this slideshow $postslist = FA_get_content($slider_id); // save the original post $original_post = $post; // this is used for comments. The comments function uses a global $id variable to count comments. the current id is for the first item in loop $original_id = $id; // @deprecated slider size. Don't use this anymore, there are template functions for this $styles = FA_style_size(); // @deprecated - set the options for older, not updated themes $options = FA_get_option('_fa_lite_aspect'); // unique ID for this slider $FA_slider_id = 'FA_slider_' . $slider_id; // if slideshow HTML should be returned, do it if (!$echo) { ob_start(); } // include the template file include $theme_display; // get the output it it is to be returned if (!$echo) { $slider_content = ob_get_contents(); ob_end_clean(); } // give $post and $id his original value $post = $original_post; $id = $original_id; // return slideshow if asked as return value if (!$echo) { return $slider_content; } }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php _e('FeaturedArticles Lite - Slider preview', 'falite'); ?> </title> <?php wp_head(); ?> </head> <body> <?php $s = FA_style_size($slider_id); ?> <div class="backend-preview" style="<?php echo $s['x']; ?> ; margin:20px auto;"> <?php FA_display_slider($slider_id); ?> </div> <?php wp_footer(); ?> </body>