/** * Outputs the content of the widget * * @param array $args * @param array $instance */ public function widget($args, $instance) { echo $args['before_widget']; // Get post $post = get_post(); // Include template bootstrap_widgets_include_template('bootstrap-advertisement-widget', $instance); echo $args['after_widget']; }
/** * Outputs the content of the widget * * @param array $args * @param array $instance */ public function widget($args, $instance) { if (!is_single()) { return; } echo $args['before_widget']; // Get post $post = get_post(); // Include template bootstrap_widgets_include_template('bootstrap-post-parallax-header-widget', array('post' => $post)); echo $args['after_widget']; }
/** * Outputs the content of the widget * * @param array $args * @param array $instance */ public function widget($args, $instance) { echo $args['before_widget']; // Get posts $posts_query_args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => 5, 'order' => 'DESC', 'orderby' => 'date', 'meta_query' => array('relation' => 'OR', array('key' => 'hide_from_carousel', 'compare' => 'NOT EXISTS'), array('key' => 'hide_from_carousel', 'value' => 'no'))); $posts_result = get_posts($posts_query_args); // Reverse results $posts_result = array_reverse($posts_result); // Include template bootstrap_widgets_include_template('bootstrap-posts-carousel-widget', array('posts' => $posts_result)); echo $args['after_widget']; }
/** * Outputs the content of the widget * * @param array $args * @param array $instance */ public function widget($args, $instance) { echo $args['before_widget']; $posts_per_page = get_option('posts_per_page'); $page = get_query_var('paged'); if ($page == '') { $page = get_query_var('page'); } if ($page < 1) { $page = 1; } // Get posts $posts_query_args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $posts_per_page, 'offset' => $posts_per_page * ($page - 1), 'order' => 'DESC', 'orderby' => 'date'); if (isset($args['category'])) { $posts_query_args['category'] = $args['category']; } $posts_result = get_posts($posts_query_args); // Include template bootstrap_widgets_include_template('bootstrap-posts-panels-widget', array('posts' => $posts_result)); echo $args['after_widget']; }