Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //* Enqueue scripts
- add_action( 'wp_enqueue_scripts', 'minimum_front_page_enqueue_scripts' );
- function minimum_front_page_enqueue_scripts() {
- //* Load scripts only if custom background is being used
- if ( ! get_background_image() )
- return;
- //* Enqueue Backstretch scripts
- wp_enqueue_script( 'minimum-backstretch', get_bloginfo( 'stylesheet_directory' ) . '/js/backstretch.js', array( 'jquery' ), '1.0.0' );
- wp_enqueue_script( 'minimum-backstretch-set', get_bloginfo('stylesheet_directory').'/js/backstretch-set.js' , array( 'jquery', 'minimum-backstretch' ), '1.0.0' );
- wp_localize_script( 'minimum-backstretch-set', 'BackStretchImg', array( 'src' => get_background_image() ) );
- //* Add custom body class
- add_filter( 'body_class', 'minimum_add_body_class' );
- }
- //* Minimum custom body class
- function minimum_add_body_class( $classes ) {
- $classes[] = 'minimum';
- return $classes;
- }
- //* Add even/odd post class
- add_filter( 'post_class', 'minimum_even_odd_portfolio_post_class' );
- function minimum_even_odd_portfolio_post_class( $classes ) {
- global $wp_query;
- $classes[] = ($wp_query->current_post % 2 == 0) ? 'portfolio-odd' : 'portfolio-even';
- return $classes;
- }
- function minimum_portfolio_grid() {
- if ( $image = genesis_get_image( 'format=url&size=portfolio' ) ) {
- printf( '<div class="portfolio-image"><a href="%s" rel="bookmark"><img src="%s" alt="%s" /></a></div>', get_permalink(), $image, the_title_attribute( 'echo=0' ) );
- }
- }
- //* Add widget support for homepage if widgets are being used
- add_action( 'genesis_meta', 'minimum_front_page_genesis_meta' );
- function minimum_front_page_genesis_meta() {
- if ( is_home() ) {
- //* Remove the entry meta in the entry header
- remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
- remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
- remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
- //* Remove the entry content
- remove_action( 'genesis_entry_content', 'genesis_do_post_content' );
- //* Remove the entry image
- remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
- //* Add the featured image after post title
- add_action( 'genesis_entry_content', 'minimum_portfolio_grid' );
- //* Remove entry footer functions
- remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_open', 5 );
- remove_action( 'genesis_entry_footer', 'genesis_post_meta' );
- remove_action( 'genesis_entry_footer', 'genesis_entry_footer_markup_close', 15 );
- //* Force full width content layout
- add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
- }
- if ( is_active_sidebar( 'home-featured-1' ) || is_active_sidebar( 'home-featured-2' ) || is_active_sidebar( 'home-featured-3' ) || is_active_sidebar( 'home-featured-4' ) ) {
- //* Add Home featured Widget areas
- add_action( 'genesis_before_content_sidebar_wrap', 'minimum_home_featured', 15 );
- }
- }
- //* Add markup for homepage widgets
- function minimum_home_featured() {
- printf( '<div %s>', genesis_attr( 'home-featured' ) );
- genesis_structural_wrap( 'home-featured' );
- genesis_widget_area( 'home-featured-1', array(
- 'before' => '<div class="home-featured-1 widget-area">',
- 'after' => '</div>',
- ) );
- genesis_widget_area( 'home-featured-2', array(
- 'before' => '<div class="home-featured-2 widget-area">',
- 'after' => '</div>',
- ) );
- genesis_widget_area( 'home-featured-3', array(
- 'before' => '<div class="home-featured-3 widget-area">',
- 'after' => '</div>',
- ) );
- genesis_widget_area( 'home-featured-4', array(
- 'before' => '<div class="home-featured-4 widget-area">',
- 'after' => '</div>',
- ) );
- genesis_structural_wrap( 'home-featured', 'close' );
- echo '</div>'; //* end .home-featured
- }
- //* Run the Genesis loop
- genesis();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement