/** * This function adjusts the main query arguments on the home (blog) page if Baton Conductor * is enabled. */ public function pre_get_posts($query) { // Bail if Baton Conductor is not enabled, we're in the admin, this isn't the main query, or we're not on the home (blog) page if ($this->is_baton_conductor_disabled() || is_admin() || !$query->is_main_query() || !$query->is_home()) { return; } // Grab the Baton Conductor Query instance $baton_conductor_query = Baton_Conductor_Query(); // If we're in the Customizer, setup the theme mod if (is_customize_preview()) { $this->setup_theme_mod(); } // Adjust the posts per page $query->set('posts_per_page', !empty($this->baton_conductor_theme_mod['posts_per_page']) && $this->baton_conductor_theme_mod['posts_per_page'] !== 0 ? $this->baton_conductor_theme_mod['posts_per_page'] : $baton_conductor_query->post_count->publish); // Adjust the category $query->set('cat', $this->baton_conductor_theme_mod['category']); // Ignore sticky posts $query->set('ignore_sticky_posts', true); }
?> </<?php echo $this->get_content_wrapper_html_element($post, $instance, $baton_conductor, $query); ?> > <?php } /** * This function outputs the closing wrapper for Conductor Widgets. */ public function baton_conductor_wrapper_close($post, $instance, $baton_conductor, $query) { do_action('baton_conductor_output_after', $post, $instance); ?> </<?php echo $this->get_wrapper_html_element($post, $instance, $baton_conductor, $query); ?> > <?php } } /** * Create an instance of the Baton_Conductor_Query class. */ function Baton_Conductor_Query() { return Baton_Conductor_Query::instance(); } Baton_Conductor_Query(); // Conduct your content! }
<?php global $post; // Grab the Baton Conductor instance $baton_conductor = Baton_Conductor_Instance(); // Grab the Baton Conductor instance (settings) $baton_conductor_instance = $baton_conductor->get_baton_conductor_instance(); // Grab the Baton Conductor Query instance $baton_conductor_query = Baton_Conductor_Query(); /* * Featured Image */ $featured_image_style = ''; // Grab the featured image priority $featured_image_priority = $baton_conductor_instance['output_elements']['featured_image']; // Grab the featured image output element $featured_image_output_element = $baton_conductor_instance['output'][$featured_image_priority]; // If the featured image is visible if ($featured_image_output_element['visible'] && has_post_thumbnail()) { $featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full'); // Add the background image CSS $featured_image_style .= 'background-image: url(' . esc_url($featured_image[0]) . ');'; } ?> <div id="baton-baton-conductor-enhanced-hero-1" class="baton-hero-widget widget baton-baton-conductor-enhanced" style="<?php echo esc_attr($featured_image_style); ?> "> <div class="in baton-baton-conductor-enhanced-in cf"> <div class="baton-baton-conductor-enhanced-wrapper baton-hero-1 baton-baton-conductor-enhanced-baton-hero-1 baton-hero baton-baton-conductor-enhanced-baton-hero">