/**
  * Shortcode fa_slider callback function.
  * Displays a slider from shortcode.
  */
 public function shortcode_fa_slider($atts)
 {
     // if displaying a slider, don't allow the shortcodes to avoid an infinite loop
     global $fa_slider;
     if ($fa_slider) {
         return;
     }
     $data = $this->shortcodes('fa_slider');
     $this->atts = shortcode_atts($data['atts'], $atts);
     foreach ($this->atts as $key => $value) {
         if ('false' == $value && is_bool($data['atts'][$key])) {
             $this->atts[$key] = false;
         }
     }
     extract($this->atts, EXTR_SKIP);
     $show = true;
     // store the current slider id
     $this->slider_id = $id;
     // display the slider. Assign as area shortcode_area
     ob_start();
     fa_display_slider($id, 'shortcode_area');
     $output = ob_get_clean();
     // clear the slider id class variable
     $this->slider_id = false;
     $this->atts = array();
     // return the slider output
     return $output;
 }
示例#2
0
 /**
  * (non-PHPdoc)
  * @see WP_Widget::widget()
  */
 function widget($args, $instance)
 {
     if (!$instance || (!isset($instance['slider_id']) || !$instance['slider_id'])) {
         return;
     }
     $slider = get_post($instance['slider_id']);
     if (!$slider || 'publish' != $slider->post_status && !fa_is_preview()) {
         return;
     }
     extract($args, EXTR_SKIP);
     // output HTML before widget as set by sidebar
     echo $before_widget;
     // output the widget title
     $title = apply_filters('widget_title', $instance['title']);
     if ($instance['title']) {
         // output the widget title
         echo $before_title . $title . $after_title;
     }
     $this->slider_id = $instance['slider_id'];
     $this->atts = $instance;
     // display the slider; assign it to widget area to be able to check into the display filter (index.php in plugin files).
     fa_display_slider($instance['slider_id'], 'widget_area');
     // output HTML after widget as set by sidebar
     echo $after_widget;
     // clear the slider id class variable
     $this->slider_id = false;
     $this->atts = array();
     // remove the filter to avoid messing the display of the slider on other areas
     remove_filter('fa_get_slider_options', array($this, 'options'), 999);
     // remove show filter
     remove_filter('fa_display_slider', array($this, 'overwrite_options'), 999);
 }
示例#3
0
文件: index.php 项目: vrxm/htdocs
 /**
  * Display sliders above the main loop in page
  * @param object $query
  */
 public function show_on_loop_start($query)
 {
     // don't display on admin pages, previews or if it's not main query
     if (is_admin() || !$query->is_main_query()) {
         return;
     }
     /**
      * Filter to prevent dynamic areas globally from being displayed
      * @var bool
      */
     $show = apply_filters('fa_display_dynamic_areas', true, 'loop_start');
     if (!$show) {
         return;
     }
     $settings = fa_get_options('hooks');
     $sliders = (array) $settings['loop_start']['sliders'];
     if ($sliders) {
         foreach ($sliders as $slider_id) {
             fa_display_slider($slider_id, 'loop_start');
         }
     }
 }
示例#4
0
			<?php 
while (have_posts()) {
    the_post();
    ?>



			<?php 
}
// End of the loop.
?>
        
        <!-- FA slider featured article -->
        <?php 
if (function_exists('fa_display_slider')) {
    fa_display_slider(87);
}
?>
     

        <div class="row border-top space-after">
          <h1 class="cat-butt">news</h1>
        </div>
        
        <div class="row">
          <!--Query the database and show my 4 posts from the news category-->
          <?php 
$custom_query = new WP_Query('posts_per_page=4&category_name=news');
while ($custom_query->have_posts()) {
    $custom_query->the_post();
    ?>
示例#5
0
 * It is used to display a page when nothing more specific matches a query.
 * For example, it puts together the home page when no home.php file exists.
 *
 * @link https://codex.wordpress.org/Template_Hierarchy
 *
 * @package WordPress
 * @subpackage Twenty_Thirteen
 * @since Twenty Thirteen 1.0
 */
get_header();
query_posts('offset=4');
?>
 <div class="banner" id="index">
 <?php 
if (function_exists('fa_display_slider')) {
    fa_display_slider(7585);
}
?>
    </div>
<div class="l-page fc">
	<div class="fg-9 fc">
		<div id="primary" class="content-area">
			<div id="content" class="site-content" role="main">
				<?php 
if (have_posts()) {
    ?>

					<?php 
    /* The loop */
    ?>
					<?php